Leser: 18
echo "a#b#c#d" | tr '#' '\n' | perl -pe 's/b\nc/bc/g'
echo "a#b#c#d" | tr '#' '\n' | perl -pe 's/b$^c/bc/mg'
echo "a#b#c#d" | tr '#' '\n' | perl -pwe 'BEGIN { $/ = undef } s/b\nc/bc/'
echo "a#b#c#d" | tr '#' '\n' | perl -e '@_ = <STDIN>; $_ = join("", @_); s/b\nc/bc/g; print $_;'
2011-01-27T12:32:48 SEAIch habe noch eine zweite Lösung:
Code: (dl )echo "a#b#c#d" | tr '#' '\n' | perl -e '@_ = <STDIN>; $_ = join("", @_); s/b\nc/bc/g; print $_;'
echo "a#b#c#d" | tr '#' '\n' | perl -ne 'if($last){ $m="$last$_"; print $m=~s/b\nc/bc/g?$m:$last;} $last=$_; END{print $last}'