On Thu, Sep 11, 2014 at 12:33 AM, Douglas A. Augusto
<daaugu...@gmail.com> 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 'u...@server.net' | perl -ne '/\qu...@server.net\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 'u...@server.net' | perl -ne "\$a='u...@server.net';/\\Q\$a\\E/ and print"

echo 'u...@server.net' | 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

Reply via email to