Irregular character search and replace?

Nicola Larosa nico at tekNico.net
Sun May 2 22:02:58 UTC 2004


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

> sed -i "s/\r//" $2

If by chance you use this on a Macintosh text file, you will get one long,
lonely line.

Try these two commands (order is important), they work on Mac, Dos and Unix files.

# convert Dos files only, leave the others untouched
sed -i "s/\r\n/\n/" $2
# any CR left? Could be a Mac file
sed -i "s/\r/\n/" $2

Whatever you do, don't use these commands on binary files. ;^)


- --
Nicola Larosa - nico at tekNico.net

"People get worried about .NET and decide to rewrite their whole
architecture for .NET because they think they have to. Microsoft is
is shooting at you, and it's just cover fire so that they can move
forward and you can't, because this is how the game is played, Bubby."
  -- Joel Spolsky, January 2004


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFAlXAQXv0hgDImBm4RAlpOAKCkSnJX1CN3rsavY7IjZPzCfrUGZQCcDxKH
A5i1QuJdCEYjAGxdEpnYOmc=
=CQMD
-----END PGP SIGNATURE-----




More information about the mc mailing list