Hi
Personally i use this as it also strips off # comments in the middle of a line and strips spaces off the end of a line.
Code:
sed -e 's/#.*$//' -e 's/[ ]*$//' -e '/^$/d'
Code:
matthew-S206:/home/matthew/useful_commands_dir % cat tmp
This
#deb http://ppa.launchpad.net/xorg-edgers/ppa/ubuntu raring main
is
#deb http://ppa.launchpad.net/xorg-edgers/ppa/ubuntu raring main
a test # test
matthew-S206:/home/matthew/useful_commands_dir % sed -e 's/#.*$//' -e 's/[ ]*$//' -e '/^$/d' tmp
This
is
a test
matthew-S206:/home/matthew/useful_commands_dir %
EDIT: You can use a semi colon as a delimiter as well.
Kind regards
Bookmarks