Monday, August 6, 2012

How do you find the number of lines in a file in UNIX?

wc -l <File Name>
or
awk 'END {print NR}' <File Name>
or
sed -n '$=' <File Name>
or
grep -c "." <File Name>
or
grep -c "^" <File Name>

No comments :