in reply to Re: How to delete ^M character using regex
in thread How to delete ^M character using regex

Just wondering if this is not platform specific. If you bring windows text files to Un*x (using your USB key and not FTP ascii mode for ex.), it's probably what you need (and what the OP needed :). But in general (supposing an ASCII world) why not spell in full i.e s/\015//g; On the mac, line-endings are ^M and that's the \n escape, isn't?, so my guess is that \r will be different...but I have no mac (yet) and cannot prove it ;)

% stephan@armen (/esc) % % cat -evnt hi1; echo; perl -lpe 's/\015//g' hi1 | cat -evnt 1 hello world^M wake up^M please$ 2 and be good$ 1 hello world wake up please$ 2 and be good$
hth --steph

Replies are listed 'Best First'.
Re^3: How to delete ^M character using regex
by rinceWind (Monsignor) on Dec 21, 2006 at 15:35 UTC

    You're right, and I don't have an old Mac to verify this on (OSX uses the Unix line ending convertion afaik). perlport shows the various line termination combinations in an ASCII table.

    As the OP referred to ^M not CR or ASCII 13, I could infer that the platform was not an old mac.

    --

    Oh Lord, won’t you burn me a Knoppix CD ?
    My friends all rate Windows, I must disagree.
    Your powers of persuasion will set them all free,
    So oh Lord, won’t you burn me a Knoppix CD ?
    (Missquoting Janis Joplin)