Hi Monks.
First of all I have to say that I'm a perl enthusiast, but not a good developer...
Anyway, this is my question.
I have to connect to a series of machines to grep in some file a defined string, let's say "AAA=", without characters before. So I write:
... my $regexpaaa=qq/-i -e \'\^AAA=\'/; my @command2 = ("ssh us\@ip -o BatchMode=yes grep $regexpaaa $dir/$fil +e"); ...
This code works fine for me. But, for my happiness, someone put some characters (let's say: XXXXX) before "AAA=" string. So I arranged my code differently:
... my $regexpaaa=qq/-i -e \'\^AAA=\'/ -e \'\^XXXXX\ AAA=\'/; my @command2 = ("ssh us@pp -o BatchMode=yes grep $regexpaaa $dir/$file +"); ...
But this time, it doesn't work. ssh command or perl aren't able to interpret correctly the second regexp. The error is: "grep: AAA=: No such file or directory"
Probably exists some perl module that would help me, but I can't use them. Sure I can't.
Some idea?

Thank you very very much.
Hveneticus.


In reply to perl, ssh and grep by hveneticus

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.