Wednesday, October 28, 2009

A sed keeper...

For those of you who are shell scripters, you may find this one useful:

/bin/sed ':a;N;$!ba;s/\n\n\n*/\n\n/g'

This removes multiple blank spaces in a file and replaces them with only one blank space. There are other ways to do this, but this is one of them...

Source: http://linux.dsplabs.com.au/rmnl-remove-new-line-characters-tr-awk-perl-sed-c-cpp-bash-python-xargs-ghc-ghci-haskell-sam-ssam-p65/