oneliners

This is part of The Pile, a partial archive of some open source mailing lists and newsgroups.



Subject: Re: how to grep one word from a line
From: "Steve \"Stevers!\" Coile" <scoile@redhat.com>
Date: Sun, 13 Jun 1999 20:27:48 -0400 (EDT)


On Mon, 14 Jun 1999, Dawid Michalczyk wrote:
[...]
> To be more specific, I'm writing a script which counts bitmap files.
> Here is an excerpt:
> 
> ###### counting png 
> 
>  find . -name "*.png" > png ; 	 
>  wc -l png > png2  # this generates the 2 words on one line, ex: "232
> png"
>  read PNG < png2   # this puts "232 png" in PNG, but I only want the
> integers

Try:

	PNG=`find . -name '*.png' | awk '{ next }; END { print NR }'`

or:

	PNG=`find . -name '*.png' | wc -l | awk '{ print $1 }'`

===


the rest of The Pile (a partial mailing list archive)

doom@kzsu.stanford.edu