When you say "put the command in a script", do you mean that you have a perl script that contains something like this?
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.)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 );
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
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |