From your description, it sounds like perl is installed on each of the remote hosts. So how about if you create the intended filter script as a file on your local host first (and debug it on your local host, to be sure), then for each of your remote hosts:
- scp filter.pl remote.host:/your/home/filter.pl - ssh remote.host /your/home/filter.pl /etc/sysconfig/netdump
Note that you can include the "-i" and "-p" flags on the shebang line of the script file, so the script itself can still be just a one-liner (after the shebang line).

If the idea is that each remote host needs a different value in "ip-address-here", you just need a script on the local host that loops over the list of remote hosts, and for each one:

- create the version of the script for this host as "tmp.pl" - scp tmp.pl remote.host:/your/path/tmp.pl - ssh remote.host /your/path/tmp.pl /etc/sysconfig/netdump - for neatness, tmp.pl could include a third line (after the shebang and the s/.../.../): END { unlink /your/path/tmp.pl }
This will avoid the problem your having with insufficient quoting/escaping of shell metacharacters needed for the command-line perl script to work as intended in the remote shell.

In reply to Re: Search and replace on remote system using rsh by graff
in thread Search and replace on remote system using rsh by bowei_99

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.