Sunday, February 14, 2010
use sed when ....
# insert a blank line above every line which matches "regex"
sed '/regex/{x;p;x;}' OR sed '/regex/{x;G;}'
# insert a blank line below every line which matches "regex"
sed '/regex/G'
# insert a blank line above and below every line which matches "regex"
sed '/regex/{x;p;x;G;}'
# remove the header of a file
sed '/1,1d' filename
Subscribe to:
Comments (Atom)
