Friday, February 17, 2012

Sed search for variable and delete entire line, but variable contains forward /'s

Sed search for variable and delete entire line, but variable contains forward /'s

Write this one down, because if you are a sed user and you forget this exact trick, it is *really hard to find* with Google (I use sed substitution like 's:path1:path2:g' all the time, but am still learning about the subtleties of delete...):

If an alternative to the usual '/' delimiter is used in a sed line range the first one has to be escaped with a '\'. Try:
sed "\%$path%d" file

'via Blog this'

No comments:

Post a Comment