Line Count and Append it to the end of the file.

Hi,

I want to get a Line count of a file and append that at the end of the file. The Line count should not include the Headers :

------------------
COL1,COL2,COL3
123,abc,011
111,abd,0212
Record Count: 2
-------------------

Thanks.

??

How can you tell what is are the Headers?

Header is always the 1st row.

here is your solution

wc -l file_name.txt | nawk '{print "\tRecord count :" expr $1-1}' >> file_name.txt

Thanks
Soni

ant:/home/vbe/test $ echo "Record Count " $(echo "$(cat blah|wc -l)" -1|bc) >>blah
ant:/home/vbe/test $ more blah
THIS IS A HEADER
sdfh
sdgk
sdgkj
Record Count 3
blah: END

$ awk ' {print} ; END {print "Record Count:"NR-1}' smc3
COL1,COL2,COL3
123,abc,011
111,abd,0212
Record Count:2

Thanks!

awk '{print}
END{
 print "Row:"NR-1
 }' filename