On Mon, Mar 10, 2003 at 09:18:05PM +, Colin Watson wrote:
> Then there are the usual tricks of eliminating whitespace and so on. In
> fact, all the whitespace in the arguments to perl in the line above can
> be removed if you feel so inclined:
>
> perl -lane'print$F[2]if$F[1]eq"1957"' < mat.
Colin, you are the king.
On Mon, Mar 10, 2003 at 09:18:05PM +, Colin Watson wrote:
> On Mon, Mar 10, 2003 at 12:26:47PM -0800, Osamu Aoki wrote:
> > Another guy replied with
> (All of this is untested.)
Here is my test results.
> Well, you can clearly save some keystrokes by using a postfix
On Mon, Mar 10, 2003 at 09:18:05PM +, Colin Watson wrote:
> (All of this is untested.)
> perl -lane'print$F[2]if$F[1]eq"1957"' < mat.txt
>
> Shorter solutions may be possible.
>
> Google for "Perl Golf" if you're interested in this kind of thing: the
> art of solving problems in the fewest
On Mon, Mar 10, 2003 at 12:26:47PM -0800, Osamu Aoki wrote:
> Another guy replied with
>
> perl -ne 'if ((my @fields = split)[1] eq "1957") { print "$fields[2]\n" }'
>
> I tested all:
>
> [EMAIL PROTECTED]:osamu$ perl -ne 'if ((my @f = split)[1] eq "1957") { print
> "$f[2]\n" }' < mat.txt
> 1
Hi, (back to list)
On Mon, Mar 10, 2003 at 12:25:18AM -0800, Alvin Oga wrote:
> On Mon, 10 Mar 2003, Osamu Aoki wrote:
> > On Sun, Mar 09, 2003 at 11:37:00PM -0800, Alvin Oga wrote:
> > > i say its ( a wild guess )
> > >
> > > perl -ne 'print (split('\t'))[2] if (split('\t'))[1]==1957' ;
> >
> >
hi ya
On Mon, 10 Mar 2003, Osamu Aoki wrote:
> So here is similar one liners but ...
>
> awk '{ print $3 }'# extract third field separated by space
>
> awk -F'\t' '{ print $3 }' # extract third field separated by tab
>
> awk -F'\t' '($3=="111")'
> perl -ne 'print if (split('\t'))[2]
Hi, It was fun reading s thead :-)
On Mon, Mar 10, 2003 at 04:02:47AM +0900, Youichi Mano wrote:
> I want to extract the lines of which the specified column is matched
> by command line programs(grep,cut,wc,...) not any script file.
So here is similar one liners but ...
awk '{ print $3 }'
7 matches
Mail list logo