sidnow
1
I want count number of characters / find the length of the 'wc -l' output
This is the command
bash-3.2$ gzcat /home/sid/file1.dat |wc -l
830752
So final out I want is 6 i.e lenght of 830752
I tried with awk
bash-3.2$ gzcat /home/sid/file1.dat |wc -l | awk '{print length ($0) }'
8
it gave me 8, possibly padding the first two characters.
Can someone help me achieve this?
Thanks
See the man pages. wc. -l counts lines
the wc version on bash provides a -m, -c and -k switch to count characters.
sidnow
3
That doesnt solve my problem. I want the count of characters of the row count of all rows. Which means I need the count of wc -l
wc -l yourfile | awk -F" " '{print length($1)}'
still not sure what you are looking for
y=$(cat yourfile | wc -l)
echo "${#y}"