TCLUG Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [TCLUG:1906] Shell Script Question -- CR/LF
Hello all:
> Hi All. I work in a Windows 95 environment making and modifying HTML
> documents to go on a Unix server. This of course means I am plauged ...
{snip}
> But what I would like to do is write a shell script to remove the ^M
> from every file in a directory. Brad says tr can be used for this, but I
> have no experience with this tool...what parameters would I need to give
> it in order to make this work?
Not to disparage 'tr', but I'd use Perl (if you have it) for
ease of use (no "scripting" necessary):
perl -pi.bak -e 's/\r\n/\n/g' file1 file2 ...
Or for no backups:
perl -pi -e 's/\r\n/\n/g' file1 file2 ...
Cheers,
John
P.S. - *wham* *wham* *wham*. OK, you're in the club.
Hey, am *I* in the club?