H.S. wrote: > Then > $> sed -e 's/\(a(.*)\)1b/\123b/' foo.dat > foo_new.dat > > Or just: > $> sed -e 's/1b/23b/' foo.dat > foo_new.dat > > if only 1b is to be replaced. Same thing using perl (will replace > contents of foo.dat inplace): > $> perl -p -i -e "s/1b/23b/g;" foo.dat > > > Regards
perl offers also forward backward lookup in regex, which makes it very flexible. (?: REGEXP ) Like (REGEXP) but does not make back-references. (?= REGEXP ) Zero width positive look-ahead assertion. (?! REGEXP ) Zero width negative look-ahead assertion. http://networking.ringofsaturn.com/Unix/regex.php -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org