Ways to get a count of the number of lines in a file:
1. Using the "wc" command
$ wc -l <filename>
2. Using "awk"
$ awk 'END{ print NR }' <filename>
3. Using "sed"
$ sed -n \$= <filename>
Just a little appetizer - nothing heavy!
Thanks for sharing! sed was the new one for me.
Another way is : cat -n <filename> | awk '{print $1}' | tail -1
Just for fun:
c=0; while read line; do ((c++)); done < <filename>; echo $c
Look at ya flexing
Nice!!!!!
Red Hat
Learning Community
A collaborative learning environment, enabling open source skill development.