Delete blank lines: awk NF | skip the header and find the sum of col #4 program | awk 'NR>1{i+=$4}END{print i}'
Delete blank lines:
[root@localhost tmp]# cat /tmp/file
werwerewr
werwerwe
ewrwer
erwer
[root@localhost tmp]# cat /tmp/file | awk NF
werwerewr
werwerwe
ewrwer
erwer
[root@localhost tmp]# cat /tmp/file
werwerewr
werwerwe
ewrwer
erwer
[root@localhost tmp]# cat /tmp/file | awk NF
werwerewr
werwerwe
ewrwer
erwer
===============
skip the header row and find the sum of column #4
program | awk 'NR>1{i+=$4}END{print i}'
skip the header row and find the sum of column #4
program | awk 'NR>1{i+=$4}END{print i}'
Comments
Post a Comment