Tuesday, August 2, 2011

Some useful sed commands

to remove the first line of a file from our output stream

$ sed -e '1d' filename | more

to delete lines 1-10 of the output

$ sed -e '1,10d' filename | more

to delete lines that start with a "#" from files

$ sed -e '/^#/d' filename | more

to print only virtualHosts in apache conf

$ sed -n '/^ /path/to/httpd.conf

No comments:

Post a Comment