javpra has asked for the wisdom of the Perl Monks concerning the following question:
I'm new to Perl and have fallen in love with it as an all in one replacemnt for sh, sed, and awk. I am having trouble with getting the following line to work from within a script. How can this:
perl -F: -lane 'print $F[2]' checkstatres.txtbe made to work in a script. I tried the following, but it didn't work.
#!/usr/bin/perl use strict; use warnings; my @args; @args = ("cciss_vol_status /dev/ciss0 > checkstatres.txt"); open RESULTS, "checkstatres.txt" || die "can't open datafile: $!\n"; while (<RESULTS>){ 'print $F[2]'; }
Any help that this noob can be given is greatly appreciated.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: specific field selection
by Corion (Patriarch) on Mar 05, 2008 at 20:38 UTC | |
|
Re: specific field selection
by NetWallah (Canon) on Mar 05, 2008 at 23:05 UTC | |
by javpra (Initiate) on Mar 06, 2008 at 15:34 UTC | |
by NetWallah (Canon) on Mar 06, 2008 at 16:55 UTC | |
by javpra (Initiate) on Mar 07, 2008 at 21:54 UTC | |
by NetWallah (Canon) on Mar 08, 2008 at 01:32 UTC |