[BNM] Batch removal of carriage returns

Jay Caines-Gooby jay at gooby.org
Thu Jul 12 19:40:47 BST 2007


On 7/12/07, Ben Lobo <ben.lobo at hobointernet.com> wrote:
> Does anyone know of a linux utility that'll find any files with a
> specific extension in a directory (and its subdirectories) and remove
> any Windows carriage return characters (CR) from those files?

find . -name *\.txt -exec sed -i \.bak 's/\r//' {} \;

find in the current directory (.) and any below it, any files with an
extension of .txt, execute the sed command which replaces carriage
return (\r) with nothing, leave a copy of the original file  with an
extension of .bak

-- 
Jay Caines-Gooby
jay at gooby.org
+44 (0)7956 182625
skype:jaygooby
http://snipperoo.com
http://blog.snipperoo.com
http://payperwidget.com - widget distribution marketplace



More information about the BNMlist mailing list. Powered by Wessex Networks