eliminate character with sed

Robert Bonomi bonomi at mail.r-bonomi.com
Sun May 20 16:22:12 UTC 2012


> From owner-freebsd-questions at freebsd.org  Sun May 20 11:11:00 2012
> Date: Sun, 20 May 2012 12:08:04 -0400
> From: Tim Dunphy <bluethundr at gmail.com>
> To: freebsd-questions <freebsd-questions at freebsd.org>
> Subject: eliminate character with sed
>
> Hello list,
>
>  I have a few php config files that have the windows delimiter
> character in them  ('^M') that I would like to get rid of. I'm trying
> to use sed to do it, and for some reason I am not having any luck.
>
> Here's the line that I'm trying to use:
>
>  #sed -i '.bak' 's/^M//g' config.php
                     ^^
                     ||

I strongly suspect that you are typing '^M' as _two_ characters, literally
a "^" and an "M".

_THAT_ won't work.  <wry grin>

You need to type a "[CTL]V", followed by a [CTL]M,  to get the right magic
in the sed command

HOWEVER, it is far easier to simply use:
    tr -d "\r" <original >new




More information about the freebsd-questions mailing list