Monday, June 29, 2009

Different ways to count the number of lines in a file

-bash-3.00$ awk 'END{print NR}' file
16
-bash-3.00$ wc -l file
16 file
-bash-3.00$ sed -n '$=' file
16
-bash-3.00$

No comments:

Post a Comment