[Techtalk] real life kewl text-processing and regexps sampleswanted

dominik.schramm at gmxpro.net dominik.schramm at gmxpro.net
Sat Jan 10 14:54:37 EST 2004


"Kathryn Hogg" <kjh at flyballdogs.com> writes:
> Brenda Bell said:
>> A command I use a lot is:
>>
>>     cat dos-file.txt | sed -e '1,$s\^M\\g' >linux-file.txt
>
> I use dos2unix for those conversions.

dos2unix is not always installed. When I have to 
convert DOS to Unix line endings on such systems
(and I don't want to/can't install dos2unix) I use 

perl -pi -e 's/\r\n/\n/' filename

("p" means loop over input lines; "i" means in-place editing;
 "e" means use script from command line)

dominik

-- 
Dominik Schramm <dominik.schramm at gmxpro.net>
pgp key available via e-mail, web, and FTP from 
http://www.cam.ac.uk.pgp.net/pgpnet/wwwkeys.html



More information about the Techtalk mailing list