4

AWK: Cannot read Number of records greater than 1(NR>1)

view full story
linux-howto

http://www.unix.com – Hi all, I have a tab-delimited text file of size 10Mb. I am trying to count the number of lines using, Code: grep -c . sample.txt or Code: wc -l < sample.txt or Code: awk 'END {print NR}'  sample.txt All these commands shows the count as 1, which means they are reading only the first header line of the file. None of the commands are giving the correct count of lines. Could anyone help to get the count of all lines in the file using awk. A sample file is attached for reference. Attached Files sample.txt (3.1 KB) (HowTos)