[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: text editing



On 2003-05-24 13:44:38, Tsuyoshi Takada wrote:
> $ wc -l 1.txt
> returns
> " 150 1.txt"
> 
> I want to extract the lines count "100" as the following,
> 
> $ wc -l 1.txt | <some sommand>
> returns
> 100

If you mean 150 in the last example, then use:

cat 1.txt | wc -l | tr -d ' '

If you insist on the format you used in the above, then use something
like:

wc -l 1.txt | sed 's/[ ]*\([0-9]*\).*/\1/' or
wc -l 1.txt | awk '{print $1}'


/Allan
-- 
Allan Wind
P.O. Box 2022
Woburn, MA 01888-0022
USA

Attachment: pgpv6GMITIh1R.pgp
Description: PGP signature


Reply to: