[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Dynamically changing remote servers list
From: |
Ole Tange |
Subject: |
Re: Dynamically changing remote servers list |
Date: |
Thu, 11 Sep 2014 09:42:23 +0200 |
On Thu, Sep 11, 2014 at 12:33 AM, Douglas A. Augusto
<daaugusto@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 'user@server.net' | perl -ne '/\Quser@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 'user@server.net' | perl -ne "\$a='user@server.net';/\\Q\$a\\E/ and print"
echo 'user@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