showing word list without using "wc" commnad
Please tell me which command should I use to display count of words from a file, so that the filename is not displayed along with the word count.
|
You can just print the first column, by using awk to extract it, e.g.
$ wc -w file | awk '{print $1}' |
Putting cksum in Nylex's command produces the byte count though not the word count!?!
Code:
anisha@linux-uitj:~> cksum d.h | awk '{print $1}' |
Oops, I misread the question. I thought they just wanted to omit the filename in the wc output, rather than not using wc at all.
|
You can send the file on stdin instead of by name:
Code:
~/tmp$ wc -w numbers.txt |
Assuming you have the text file named Hamlet.txt:
Quote:
cat Hamlet.txt | tr -cs A-Za-z0-9\\047 \\012 Quote:
cat Hamlet.txt | tr -cs A-Za-z0-9\\047 \\012 | grep '.' -n Quote:
cat Hamlet.txt | tr -cs A-Za-z0-9\\047 \\012 | grep '.' -n | tail -n 1 | cut -d ':' -f 1 Quote:
|
All times are GMT -5. The time now is 11:37 AM. |