Loading ...
Sorry, an error occurred while loading the content.
 

Convert File from Unix to DOS

Expand Messages
  • Mark Mecca
    Greetings. I m trying to figure out how to convert a file that I FTP from a Unix system so that I can read it on a Windows machine. The main problem is that I
    Message 1 of 9 , Jun 4, 2004
      Greetings.
      I'm trying to figure out how to convert a file that I FTP from a Unix
      system so that I can read it on a Windows machine. The main problem
      is that I think Unix only uses a LF character at end of records and
      Windows needs a CRLF but I can't figure out how to do this in perl.

      Any advice?

      Mark
    • Paul Archer
      Well, the simplest thing is to transfer the file using FTP s ASCII or text mode, which was designed around 30 years ago to do exactly what you want. ... Q:
      Message 2 of 9 , Jun 4, 2004
        Well, the simplest thing is to transfer the file using FTP's ASCII or 'text'
        mode, which was designed around 30 years ago to do exactly what you want.

        12:00pm, Mark Mecca wrote:

        > Greetings.
        > I'm trying to figure out how to convert a file that I FTP from a Unix
        > system so that I can read it on a Windows machine. The main problem
        > is that I think Unix only uses a LF character at end of records and
        > Windows needs a CRLF but I can't figure out how to do this in perl.
        >
        > Any advice?
        >
        > Mark
        >
        >
        >
        >
        >
        > Unsubscribing info is here: http://help.yahoo.com/help/us/groups/groups-32.html
        > Yahoo! Groups Links
        >
        >
        >
        >
        >

        ------------------------------------------
        Q: What is the definition of a tachyon?
        A: It's a gluon that's not completely dry.
        ------------------------------------------
      • Mark Mecca
        I thought we were using the ASCII option to get the file but that it didn t help the situation. I will have to check. What is the text option? ... or
        Message 3 of 9 , Jun 4, 2004
          I thought we were using the ASCII option to get the file but that it
          didn't help the situation. I will have to check. What is the 'text'
          option?


          --- In perl-beginner@yahoogroups.com, Paul Archer <tigger@i...> wrote:
          > Well, the simplest thing is to transfer the file using FTP's ASCII
          or 'text'
          > mode, which was designed around 30 years ago to do exactly what you
          want.
          >
          > 12:00pm, Mark Mecca wrote:
          >
          > > Greetings.
          > > I'm trying to figure out how to convert a file that I FTP from a
          Unix
          > > system so that I can read it on a Windows machine. The main
          problem
          > > is that I think Unix only uses a LF character at end of records
          and
          > > Windows needs a CRLF but I can't figure out how to do this in
          perl.
          > >
          > > Any advice?
          > >
          > > Mark
          > >
          > >
          > >
          > >
          > >
          > > Unsubscribing info is here:
          http://help.yahoo.com/help/us/groups/groups-32.html
          > > Yahoo! Groups Links
          > >
          > >
          > >
          > >
          > >
          >
          > ------------------------------------------
          > Q: What is the definition of a tachyon?
          > A: It's a gluon that's not completely dry.
          > ------------------------------------------
        • Brad Lhotsky
          ... How is that simpler than: $data =~ s/ n/ r n/g; ? ... -- Brad Lhotsky
          Message 4 of 9 , Jun 4, 2004
            On Fri, Jun 04, 2004 at 05:55:26PM -0000, AlmaJoe wrote:
            > --- In perl-beginner@yahoogroups.com, Paul Archer <tigger@i...> wrote:
            > > Well, the simplest thing is to transfer the file using FTP's ASCII
            > or 'text'
            > > mode, which was designed around 30 years ago to do exactly what you
            > want.
            > >
            > > 12:00pm, Mark Mecca wrote:
            > >
            > > > Greetings.
            > > > I'm trying to figure out how to convert a file that I FTP from a Unix
            > > > system so that I can read it on a Windows machine. The main problem
            > > > is that I think Unix only uses a LF character at end of records and
            > > > Windows needs a CRLF but I can't figure out how to do this in perl.
            > > >
            > > > Any advice?
            > > >
            > > > Mark
            > ---------------------------
            >
            >
            > The next simplest thing, especially if you already have the file, is
            > to download the suffix sensitive, syntax highlighting free text editor
            > from www.crimsoneditor.com and use it's built-in *nix to dos to Mac
            > conversion: click on "Document" tab, click on "File Format", and
            > select whichever platform suits your fancy. It is a 1.1 MB
            > download--couldn't be simpler. There is a glitch in the program which
            > causes an error popup box to appear the first time you run it--just
            > ignore it per the instructions inside the box--and no more problems.
            >

            How is that simpler than:

            $data =~ s/\n/\r\n/g;

            ?

            >
            >
            >
            > Unsubscribing info is here: http://help.yahoo.com/help/us/groups/groups-32.html
            > Yahoo! Groups Links
            >
            >
            >
            >
            >

            --
            Brad Lhotsky <brad@...>
          • AlmaJoe
            ... or text ... want. ... The next simplest thing, especially if you already have the file, is to download the suffix sensitive, syntax highlighting free
            Message 5 of 9 , Jun 4, 2004
              --- In perl-beginner@yahoogroups.com, Paul Archer <tigger@i...> wrote:
              > Well, the simplest thing is to transfer the file using FTP's ASCII
              or 'text'
              > mode, which was designed around 30 years ago to do exactly what you
              want.
              >
              > 12:00pm, Mark Mecca wrote:
              >
              > > Greetings.
              > > I'm trying to figure out how to convert a file that I FTP from a Unix
              > > system so that I can read it on a Windows machine. The main problem
              > > is that I think Unix only uses a LF character at end of records and
              > > Windows needs a CRLF but I can't figure out how to do this in perl.
              > >
              > > Any advice?
              > >
              > > Mark
              ---------------------------


              The next simplest thing, especially if you already have the file, is
              to download the suffix sensitive, syntax highlighting free text editor
              from www.crimsoneditor.com and use it's built-in *nix to dos to Mac
              conversion: click on "Document" tab, click on "File Format", and
              select whichever platform suits your fancy. It is a 1.1 MB
              download--couldn't be simpler. There is a glitch in the program which
              causes an error popup box to appear the first time you run it--just
              ignore it per the instructions inside the box--and no more problems.
            • Bob Showalter
              ... perl -pli.bak -e 1 myfile.txt
              Message 6 of 9 , Jun 4, 2004
                Mark Mecca wrote:
                > Greetings.
                > I'm trying to figure out how to convert a file that I FTP from a Unix
                > system so that I can read it on a Windows machine. The main problem
                > is that I think Unix only uses a LF character at end of records and
                > Windows needs a CRLF but I can't figure out how to do this in perl.

                perl -pli.bak -e 1 myfile.txt
              • AlmaJoe
                ... Unix ... I forgot to mention that it is a programmer s text editor in that it automatically recognizes code keywords from Perl, C/C++, PHP, ASP, Java,
                Message 7 of 9 , Jun 4, 2004
                  --- In perl-beginner@yahoogroups.com, "AlmaJoe" <azraelle@e...> wrote:
                  > --- In perl-beginner@yahoogroups.com, Paul Archer <tigger@i...> wrote:
                  > > Well, the simplest thing is to transfer the file using FTP's ASCII
                  > or 'text'
                  > > mode, which was designed around 30 years ago to do exactly what you
                  > want.
                  > >
                  > > 12:00pm, Mark Mecca wrote:
                  > >
                  > > > Greetings.
                  > > > I'm trying to figure out how to convert a file that I FTP from a
                  Unix
                  > > > system so that I can read it on a Windows machine. The main problem
                  > > > is that I think Unix only uses a LF character at end of records and
                  > > > Windows needs a CRLF but I can't figure out how to do this in perl.
                  > > >
                  > > > Any advice?
                  > > >
                  > > > Mark
                  > ---------------------------
                  >
                  >
                  > The next simplest thing, especially if you already have the file, is
                  > to download the suffix sensitive, syntax highlighting free text editor
                  > from www.crimsoneditor.com and use it's built-in *nix to dos to Mac
                  > conversion: click on "Document" tab, click on "File Format", and
                  > select whichever platform suits your fancy. It is a 1.1 MB
                  > download--couldn't be simpler. There is a glitch in the program which
                  > causes an error popup box to appear the first time you run it--just
                  > ignore it per the instructions inside the box--and no more problems.

                  I forgot to mention that it is a programmer's text editor in that it
                  automatically recognizes code keywords from Perl, C/C++, PHP, ASP,
                  Java, html/css, LaTeX, Pascal, Fortran, MathLab, and JSP. You can
                  also customize it and add additional languages or kewords to recognize
                  as well. EditPad Pro does the same thing, but it costs $30; however
                  for an additional $20, you can get a very handy RegEx editor/debugger
                  as well (called "Regex Buddy". Both are available here:
                  http://www.editpadpro.com/
                • OkIDaN Azeri
                  if this is an ascii file you can do it this way open (output, out.txt ); while ( ) { s/ 012 015//; print output $_; } close(output); ... Unix ... I forgot
                  Message 8 of 9 , Jun 4, 2004
                    if this is an ascii file you can do it this way

                    open (output, ">out.txt");
                    while (<>)
                    {
                    s/\012\015//;
                    print output $_;
                    }
                    close(output);

                    AlmaJoe <azraelle@...> wrote: --- In perl-beginner@yahoogroups.com, "AlmaJoe" <azraelle@e...> wrote:
                    > --- In perl-beginner@yahoogroups.com, Paul Archer <tigger@i...> wrote:
                    > > Well, the simplest thing is to transfer the file using FTP's ASCII
                    > or 'text'
                    > > mode, which was designed around 30 years ago to do exactly what you
                    > want.
                    > >
                    > > 12:00pm, Mark Mecca wrote:
                    > >
                    > > > Greetings.
                    > > > I'm trying to figure out how to convert a file that I FTP from a
                    Unix
                    > > > system so that I can read it on a Windows machine. The main problem
                    > > > is that I think Unix only uses a LF character at end of records and
                    > > > Windows needs a CRLF but I can't figure out how to do this in perl.
                    > > >
                    > > > Any advice?
                    > > >
                    > > > Mark
                    > ---------------------------
                    >
                    >
                    > The next simplest thing, especially if you already have the file, is
                    > to download the suffix sensitive, syntax highlighting free text editor
                    > from www.crimsoneditor.com and use it's built-in *nix to dos to Mac
                    > conversion: click on "Document" tab, click on "File Format", and
                    > select whichever platform suits your fancy. It is a 1.1 MB
                    > download--couldn't be simpler. There is a glitch in the program which
                    > causes an error popup box to appear the first time you run it--just
                    > ignore it per the instructions inside the box--and no more problems.

                    I forgot to mention that it is a programmer's text editor in that it
                    automatically recognizes code keywords from Perl, C/C++, PHP, ASP,
                    Java, html/css, LaTeX, Pascal, Fortran, MathLab, and JSP. You can
                    also customize it and add additional languages or kewords to recognize
                    as well. EditPad Pro does the same thing, but it costs $30; however
                    for an additional $20, you can get a very handy RegEx editor/debugger
                    as well (called "Regex Buddy". Both are available here:
                    http://www.editpadpro.com/



                    Unsubscribing info is here: http://help.yahoo.com/help/us/groups/groups-32.html


                    Yahoo! Groups SponsorADVERTISEMENT


                    ---------------------------------
                    Yahoo! Groups Links

                    To visit your group on the web, go to:
                    http://groups.yahoo.com/group/perl-beginner/

                    To unsubscribe from this group, send an email to:
                    perl-beginner-unsubscribe@yahoogroups.com

                    Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.




                    ---------------------------------
                    Do you Yahoo!?
                    Friends. Fun. Try the all-new Yahoo! Messenger

                    [Non-text portions of this message have been removed]
                  • Mark Mecca
                    Thanks. I tried it but it wasn t working until I opened the actual file in a hex editor and found (to my surprise) that the records were not delimited by a LF
                    Message 9 of 9 , Jun 5, 2004
                      Thanks. I tried it but it wasn't working until I opened the actual
                      file in a hex editor and found (to my surprise) that the records were
                      not delimited by a LF character like I was told. It actually was a
                      code of 1C which is why I was having all kinds of problems. I
                      changed your command from:

                      s/\012\015//;

                      to

                      s/\x1C/\n/g;

                      and this did the trick. Thanks.


                      --- In perl-beginner@yahoogroups.com, OkIDaN Azeri
                      <okidan_nadiko@y...> wrote:
                      > if this is an ascii file you can do it this way
                      >
                      > open (output, ">out.txt");
                      > while (<>)
                      > {
                      > s/\012\015//;
                      > print output $_;
                      > }
                      > close(output);
                      >
                      > AlmaJoe <azraelle@e...> wrote: --- In perl-
                      beginner@yahoogroups.com, "AlmaJoe" <azraelle@e...> wrote:
                      > > --- In perl-beginner@yahoogroups.com, Paul Archer <tigger@i...>
                      wrote:
                      > > > Well, the simplest thing is to transfer the file using FTP's
                      ASCII
                      > > or 'text'
                      > > > mode, which was designed around 30 years ago to do exactly what
                      you
                      > > want.
                      > > >
                      > > > 12:00pm, Mark Mecca wrote:
                      > > >
                      > > > > Greetings.
                      > > > > I'm trying to figure out how to convert a file that I FTP
                      from a
                      > Unix
                      > > > > system so that I can read it on a Windows machine. The main
                      problem
                      > > > > is that I think Unix only uses a LF character at end of
                      records and
                      > > > > Windows needs a CRLF but I can't figure out how to do this in
                      perl.
                      > > > >
                      > > > > Any advice?
                      > > > >
                      > > > > Mark
                      > > ---------------------------
                      > >
                      > >
                      > > The next simplest thing, especially if you already have the file,
                      is
                      > > to download the suffix sensitive, syntax highlighting free text
                      editor
                      > > from www.crimsoneditor.com and use it's built-in *nix to dos to
                      Mac
                      > > conversion: click on "Document" tab, click on "File Format", and
                      > > select whichever platform suits your fancy. It is a 1.1 MB
                      > > download--couldn't be simpler. There is a glitch in the program
                      which
                      > > causes an error popup box to appear the first time you run it--
                      just
                      > > ignore it per the instructions inside the box--and no more
                      problems.
                      >
                      > I forgot to mention that it is a programmer's text editor in that it
                      > automatically recognizes code keywords from Perl, C/C++, PHP, ASP,
                      > Java, html/css, LaTeX, Pascal, Fortran, MathLab, and JSP. You can
                      > also customize it and add additional languages or kewords to
                      recognize
                      > as well. EditPad Pro does the same thing, but it costs $30; however
                      > for an additional $20, you can get a very handy RegEx
                      editor/debugger
                      > as well (called "Regex Buddy". Both are available here:
                      > http://www.editpadpro.com/
                      >
                      >
                      >
                      > Unsubscribing info is here:
                      http://help.yahoo.com/help/us/groups/groups-32.html
                      >
                      >
                      > Yahoo! Groups SponsorADVERTISEMENT
                      >
                      >
                      > ---------------------------------
                      > Yahoo! Groups Links
                      >
                      > To visit your group on the web, go to:
                      > http://groups.yahoo.com/group/perl-beginner/
                      >
                      > To unsubscribe from this group, send an email to:
                      > perl-beginner-unsubscribe@yahoogroups.com
                      >
                      > Your use of Yahoo! Groups is subject to the Yahoo! Terms of
                      Service.
                      >
                      >
                      >
                      >
                      > ---------------------------------
                      > Do you Yahoo!?
                      > Friends. Fun. Try the all-new Yahoo! Messenger
                      >
                      > [Non-text portions of this message have been removed]
                    Your message has been successfully submitted and would be delivered to recipients shortly.