Why do you refer to "awk" in the title of your post?

When you say "put the command in a script", do you mean that you have a perl script that contains something like this?

my $cmd = <<CMD; find . -type f | xargs grep "Login*" 2>/dev/null | grep "2006-03-08" | + perl -nae 'print "$F[0] $F[8]\n"' CMD system( $cmd );
If so, I'm sure there is a better way to do whatever you're trying to accomplish. As it is, you are probably getting fouled up by improper or inadequate escaping of "magic" characters and/or some unexpected limits on "quoting within 'quoted' strings". But I'm only guessing, because the only diagnostic info you gave us is "the command doesn't work". (I know from experience that mixing magic characters and multiple layers of quoting within a system call is awfully risky and prone to failure.)

Here's a suggestion: give us more detail about what you actually did, and about what is really meant by "doesn't work" -- e.g. the error messages and or output that you get. (While you're at it, learn about using <code> tags in your posts.)

BTW, you said that  print "$F[0] $F[8]\n" gives you the "1st and 8th" column -- I think you meant the "1st and 9th".


In reply to Re: perl and awk by graff
in thread perl and awk by Anonymous Monk

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.