Any Utility in Win32/Win95/Dos to remove CR or LF 
Author Message
 Any Utility in Win32/Win95/Dos to remove CR or LF

Any Utility in Win32/Win95/Dos to remove CR or LF? I am having problem in
executing my Perl scrip due to this?


Wed, 05 Sep 2001 03:00:00 GMT  
 Any Utility in Win32/Win95/Dos to remove CR or LF
#!/usr/bin/perl -epi.bak
s/\n\r$/\n/;  # convert \n\r to \n

script.pl file1 file2 file3 etc . . ..

or

#!/usr/bin/perl -epi.bak
s/\r//;  # remove \r from every file on command line

----------

Quote:

> Any Utility in Win32/Win95/Dos to remove CR or LF? I am having problem in
> executing my Perl scrip due to this?



Wed, 05 Sep 2001 03:00:00 GMT  
 Any Utility in Win32/Win95/Dos to remove CR or LF

Quote:
> #!/usr/bin/perl -epi.bak
> s/\n\r$/\n/;  # convert \n\r to \n

> script.pl file1 file2 file3 etc . . ..

> or

> #!/usr/bin/perl -epi.bak
> s/\r//;  # remove \r from every file on command line

probably not enough. Perl on DOS-like OS's will automatically insert CR
whenever you print "\n". It's the notion of opening file in text mode or binary
mode. The default is text mode. You must do something like

# -*- dos2unix.pl -*-
binmode STDOUT;     # swich to binary mode
while (<STDIN>) {
    s/\r//;
    print;

Quote:
}

then

perl dos2unix.pl < infile > outfile

-trung

Quote:

> ----------


> > Any Utility in Win32/Win95/Dos to remove CR or LF? I am having problem in
> > executing my Perl scrip due to this?

--
To reply by e-mail, remove 'KILLSPAM' from my address in From: line


Fri, 07 Sep 2001 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. DOS Perl convering LF to CR/LF

2. how to remove cr/lf ???

3. Converting LF to CR+LF

4. $/ = CR LF?

5. <FILE> and CR-LF

6. Binary data and CR-LF's in MSDOS

7. CR before login or any help that would lf before login

8. CR/LF

9. Question about formatting/(CR/LF) in PERL

10. Perl and CR+LF

11. CR LF to <br> in REGEX

12. CR/LF from a form

 

 
Powered by phpBB® Forum Software