Number of words multiplied by the number of lines in Linux [Archive] - C Board

PDA

View Full Version : Number of words multiplied by the number of lines in Linux


sjalesho
11-19-2003, 09:08 AM
You can do that with "wc",

1. wc - l for the number of lines
2. wc -w for the number of words

Hoe should one combine these 2, let's say if I want to multiply the number of words with the number of lines from file a and b respectively?

Thanks

Prelude
11-19-2003, 10:40 AM
Look into bc and dc.

jim mcnamara
11-20-2003, 03:25 PM
For a file named e.c:

echo `expr $(cat e.c|wc -l) \* $(cat e.c|wc -c)`