|
Prev: FAQ 8.34 I {changed directory, modified my environment} in a perl script. How come the change disappeared when I exited the script? How do I get my changes to be visible?
Next: FAQ 8.29 Why can't my script read from STDIN after I gave it EOF (^D on Unix, ^Z on MS-DOS)?
From: mmccaws2 on 8 Apr 2008 16:06 My users are will be uploading a file from unix. I'm trying to save a step by formatting the file while in unix so they don't have to format it with "perl -p -e 's/\r/\r\n/' < $infile > $dosfile" The resulting file after copied to windows did not have a readable format. Is this a process that can only be done after the file transfer? Mike
From: Joost Diepenmaat on 8 Apr 2008 16:12 mmccaws2 <mmccaws(a)comcast.net> writes: > My users are will be uploading a file from unix. I'm trying to save a > step by formatting the file while in unix so they don't have to format > it with > > "perl -p -e 's/\r/\r\n/' < $infile > $dosfile" > > The resulting file after copied to windows did not have a readable > format. Is this a process that can only be done after the file > transfer? No, you're doing it wrong. *ON UNIX*, you can do: perl -p -e 's/\n/\r\n/' < $infile > $dosfile Final results are dependent on the transfer protocol (i.e. do NOT transfer those files with FTP in ASCII mode). -- Joost Diepenmaat | blog: http://joost.zeekat.nl/ | work: http://zeekat.nl/
From: Colin B. on 8 Apr 2008 16:48 mmccaws2 <mmccaws(a)comcast.net> wrote: > My users are will be uploading a file from unix. I'm trying to save a > step by formatting the file while in unix so they don't have to format > it with > > "perl -p -e 's/\r/\r\n/' < $infile > $dosfile" > > The resulting file after copied to windows did not have a readable > format. Is this a process that can only be done after the file > transfer? Unless I'm missing something, you should just be able to do: $unix2dos $infile > $outfile Colin
From: Rich Grise on 8 Apr 2008 16:54 On Tue, 08 Apr 2008 22:12:18 +0200, Joost Diepenmaat wrote: > mmccaws2 <mmccaws(a)comcast.net> writes: > >> My users are will be uploading a file from unix. I'm trying to save a >> step by formatting the file while in unix so they don't have to format >> it with >> >> "perl -p -e 's/\r/\r\n/' < $infile > $dosfile" >> >> The resulting file after copied to windows did not have a readable >> format. Is this a process that can only be done after the file >> transfer? > > No, you're doing it wrong. > > *ON UNIX*, you can do: > > perl -p -e 's/\n/\r\n/' < $infile > $dosfile > > Final results are dependent on the transfer protocol (i.e. do NOT > transfer those files with FTP in ASCII mode). What's wrong with $ todos < $infile > $dosfile ? Thanks, Rich
From: mmccaws2 on 8 Apr 2008 17:16 On Apr 8, 1:54 pm, Rich Grise <r...(a)example.net> wrote: > On Tue, 08 Apr 2008 22:12:18 +0200, Joost Diepenmaat wrote: > > mmccaws2 <mmcc...(a)comcast.net> writes: > > >> My users are will be uploading a file from unix. I'm trying to save a > >> step by formatting the file while in unix so they don't have to format > >> it with > > >> "perl -p -e 's/\r/\r\n/' < $infile > $dosfile" > > >> The resulting file after copied to windows did not have a readable > >> format. Is this a process that can only be done after the file > >> transfer? > > > No, you're doing it wrong. > > > *ON UNIX*, you can do: > > > perl -p -e 's/\n/\r\n/' < $infile > $dosfile > > > Final results are dependent on the transfer protocol (i.e. do NOT > > transfer those files with FTP in ASCII mode). > > What's wrong with > $ todos < $infile > $dosfile > ? > > Thanks, > Rich we're using scp that comes on HPUX. The results did seem to change. Mike
|
Next
|
Last
Pages: 1 2 3 Prev: FAQ 8.34 I {changed directory, modified my environment} in a perl script. How come the change disappeared when I exited the script? How do I get my changes to be visible? Next: FAQ 8.29 Why can't my script read from STDIN after I gave it EOF (^D on Unix, ^Z on MS-DOS)? |