![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Partial Request are coming... please help | pa.chidhambaram | IP Networking | 0 | 02-05-2008 08:19 AM |
| vsftpd hiding partial uploads | jhod22 | Linux | 3 | 07-08-2006 01:49 PM |
| for linux and BSD users interested in Unix system V/bsd | moxxx68 | BSD | 0 | 12-03-2004 10:09 PM |
| Interested, but lost. | Ned | UNIX for Dummies Questions & Answers | 9 | 09-01-2003 09:03 PM |
| Extremely Interested | Punk18 | UNIX for Dummies Questions & Answers | 5 | 08-16-2001 12:36 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Command output is given to the console. As in the following case -
wc -l filename produces following output nn filename From this, I am only interested with nn(rowcount). Cant we simply extract it thr console? I also tried with null device, I know as - /dev/null wc -l filename > /dev/null | cut -d " " -f 1 /dev/null This also didnt help me. Will I have to use temporary file, in order to retrieve only rowcount? |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
The easiest way is to pipe it through awk
Code:
wc -l file | awk '{print $1}'
Code:
$ wc -l < file EDIT: Looking at this, it'd be less expensive to just do the whole thing with awk... Code:
awk '{c++} END{print c}' file
ZB Last edited by zazzybob; 12-15-2004 at 08:07 AM. |
||||
| Google The UNIX and Linux Forums |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|