Q:

How to append the word count at the end of 10 digit number in unix

I need to display the line count of the file at the end of the file as a trailer. 
I have 0000000000 (10 0's) , so if the line count is 2 then the string should be 0000000002, if the number of lines in the file are 120 then string should be 0000000120. I need to display this string at the end of the file as a trailer. Please help how this can be done in unix. 

A:

you can try awk
awk '{print}END{printf("%010i\n", NR)}' file

