I have this output:
Count Process
238 0
1 1124027
1 1124065
1 1124066
1 1124069
1 1124072
1 1124073
1 1547365
1 1547366
I wanted to add all Count except for the first line (238). How do I do this on awk?
so far I have this
awk 'NF == 1 {for (i=2;i<=FNR;++i) sum += i print $i}'
but its an error.
Edit
I am trying to parse the output of this command:
cat /proc/8920/maps | awk '{print$5}' | sort | uniq -c |`awk 'NF == 1 {for (i=2;i<=FNR;++i) sum += i print $i}'`
Everything works fine until uniq -c, but after that I have problem with awk script to add all lines in first columns except for the first line which is 238. I hope this clears things up.
Hauke Laging's answer and I came up with this script
cat /proc/8920/maps | awk '{print$5}' | sort | uniq -c | awk 'NR>1 { sum+= $1} END {print sum}'
now its working.