Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 20 May 2012 11:23:48 -0500 (CDT)
From:      Robert Bonomi <bonomi@mail.r-bonomi.com>
To:        bluethundr@gmail.com, freebsd-questions@freebsd.org
Subject:   Re: eliminate character with sed
Message-ID:  <201205201623.q4KGNmXS096669@mail.r-bonomi.com>
In-Reply-To: <CAOZy0enEPQNFrJv-xZ-H5_18_r5rvjHQQCeFQT6x26TGTf0c0g@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
> From owner-freebsd-questions@freebsd.org  Sun May 20 11:11:00 2012
> Date: Sun, 20 May 2012 12:08:04 -0400
> From: Tim Dunphy <bluethundr@gmail.com>
> To: freebsd-questions <freebsd-questions@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





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201205201623.q4KGNmXS096669>