Thursday, June 30, 2011

using sed to replace spaces

I want to replace multiple white spaces(but still keep tabs) with one space only in a file. Here is how we can do it:

sed 's/ \+/ /g' targetFile > newFile

No comments: