The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #2 (permalink)  
Old 12-15-2004
zazzybob's Avatar
zazzybob zazzybob is offline Forum Advisor  
Registered Geek
  
 

Join Date: Dec 2003
Location: Melbourne, Australia
Posts: 2,100
The easiest way is to pipe it through awk
Code:
wc -l file | awk '{print $1}'
You can omit the filename by supplying the file as STDIN, e.g.
Code:
$ wc -l < file
but you'll still get leading whitespace. So the awk solution is easiest.

EDIT: Looking at this, it'd be less expensive to just do the whole thing with awk...
Code:
awk '{c++} END{print c}' file
Cheers
ZB

Last edited by zazzybob; 12-15-2004 at 11:07 AM..