Pages

Saturday, March 31, 2012

sed: delete all lines before or after string match

delete all lines before string match including matching line


sed -i '1,//d' $FILENAME

delete all lines after string match including matching line

sed  -i  '//,$d' $FILENAME

-i option to put changes back into source file

No comments:

Post a Comment