With a little side of applesauce...

Monday, January 29, 2007

Using sed to delete the first match and then quit

I found this gem when I was trying to delete the first instance of a duplicate line in a group of files:

for conf in $(ls *publish*) ; do sed '0,/AllowOverride All/{//d;}' $conf ; done

I’ll extract the sed command for easier perusal:

sed ‘0,/AllowOverride All/{//d;}’ $conf


No comments: