Date: Sun, 20 May 2012 21:10:51 +0200 From: "Michael Ross" <gmx@ross.cx> To: freebsd-questions <freebsd-questions@freebsd.org>, "Tim Dunphy" <bluethundr@gmail.com> Subject: Re: eliminate character with sed Message-ID: <op.wemfkde9g7njmm@michael-think> In-Reply-To: <CAOZy0enEPQNFrJv-xZ-H5_18_r5rvjHQQCeFQT6x26TGTf0c0g@mail.gmail.com> References: <CAOZy0enEPQNFrJv-xZ-H5_18_r5rvjHQQCeFQT6x26TGTf0c0g@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
Am 20.05.2012, 18:08 Uhr, schrieb Tim Dunphy <bluethundr@gmail.com>:
> 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
>
> However when I have a look at the backup file that's been created with
> this command, it looks like there was no effect:
>
> <?php ^M/* Global Variables */^M if(!defined('DS'))^M
> define('DS',DIRECTORY_SEPARATOR);^M^M
> if(!defined("_MAINSITEPATH_"))^M
> define("_MAINSITEPATH_",dirname(__FILE__).DS);^M
>
> I was wondering is someone had a tip on how to run this command
> effectively in this situation.
>
> Thanks!
> tim
>
Maybe you can use /usr/ports/converters/dosunix.
Usage:
dosunix INPUTFILE OUTPUTFILE
DosUnix converts files from DOS text format to Unix text format
by replacing each carriage return & newline pair with a single
newline character.
does not do backups, though.
Michael
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?op.wemfkde9g7njmm>
