Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 8 May 2005 22:35:45 +0200
From:      regisr <regisr@pobox.com>
To:        freebsd-questions@freebsd.org
Subject:   Re: On removing ^M
Message-ID:  <20050508223545.1ab06331.regisr@pobox.com>
In-Reply-To: <427E6E22.3030400@cox.net>
References:  <20050508192019.127ED1CE303@ws1-6.us4.outblaze.com> <20050508214047.109a3584.regisr@pobox.com> <427E6E22.3030400@cox.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, 08 May 2005 12:53:06 -0700

> > tr -d "\r" < input-file > output-file
> Or:
> perl -pi -e 's/\015//' *.c
> which will edit all .c files in place, or:
> perl -pi.bak -e's/\015//' *.c

(I forget to add a for or foreach line!)

If there is a large number of files (i.e. if the command is too
long - error: "Argument list too long")

try something like:

find -X . -type f -print | xargs -L 1  perl -pi.bak -e's/\015//'

Don't forget to do a backup copy of your original files!
If filenames should be protected (enclosed in "" or '' ) the -X find
option complains and skip them.


-- 
<regisr>  



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