Thursday, April 7, 2011

Linux Tips & Tricks

Removing commented lines '#' from a file
grep -v '^#' squid.conf >

to remove empty lines from a text file. I've been using sed with
sed '/^ *$/d' > squid.conf.nospace

Do the same thing with sed in one line
sed '/^#/d' squid.conf.default | sed /^$/d >

sed -e '/^\(#\|$\)/ d' squid.conf.default >

Remove comments and blank lines from a file
egrep -v '^(#|$)' squid.conf.default >

grep '^[^#]' squid.conf >

No comments:

Post a Comment