On Thu, Sep 11, 2014 at 12:33 AM, Douglas A. Augusto
<[email protected]> wrote:
> Thanks for the suggestion. The following command almost worked:
>
> ...
> parallel -k "perl -ne 's#^(\d+\/)?\Q'{}'\E\$#\$_# and print and exit'
> original.slf" > tmp.slf
> ...
>
> The problem now it that Perl doesn't seem to like '@' inside the expression
> ({}). For instance:
>
> echo '[email protected]' | perl -ne '/\[email protected]\E/ and print'
>
> does not print anything. But
>
> echo 'user at server.net' | perl -ne '/\Quser at server.net\E/ and print'
>
> does. Any ideas?
Apparently \Q still does variable substitution. But this seems to work:
echo '[email protected]' | perl -ne "\$a='[email protected]';/\\Q\$a\\E/ and print"
echo '[email protected]' | perl -ne "\$a='"{}"';/\\Q\$a\\E/ and print"
It it starting to be as ugly as the sed command, but it might just be
more portable: We avoid having to deal with different odd dialects of
sed.
/Ole