perl -nae '...'
is equivalent to
perl -e 'while (<>) { @F = split(" "); ... }'
Does that help? I'm not sure what you are trying to do.
Perl command lin switches are documented in perlrun.
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 = <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.)/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".
perlmonks.org content © perlmonks.org and Anonymous Monk, graff, ikegami, planetscape
prlmnks.org © 2006 edmund von der burg (eccles & toad)
v 0.03