Thursday, March 14, 2013

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