Tuesday, July 5, 2011

does sed support lookahead or lookbehind on Linux?

after investigating for a while, finally I found sed does not support lookahead or lookbehind assertions.

Based on http://sed.sourceforge.net/sedfaq6.html, the modified sed, which is named as ssed, can support it in its Perl mode.


T_X said...

Aiy, had been trying to do a negative look-ahead as described here: http://stackoverflow.com/questions/406230/regular-expression-to-match-string-not-containing-a-word

And I failed miserably with sed. Thanks to your post I tried 'ssed -R' and that worked right away - thanks a lot!

Anonymous said...

Thanks from Dortmund, Germany.
Solved my problem.

Technews Able said...

Linux : positive and negative sides