Feb 3, 2004 #1 ozi403 Technical User Apr 29, 2002 54 TR How can I get total sum of output below in continueous command line? # grep ngahdsrv: deneme | grep -v savegrp: | grep -v "*" | cut -d, -f2 | awk '{ print $1 }' 17 251 944 1129 753 # thanks all.
How can I get total sum of output below in continueous command line? # grep ngahdsrv: deneme | grep -v savegrp: | grep -v "*" | cut -d, -f2 | awk '{ print $1 }' 17 251 944 1129 753 # thanks all.
Feb 3, 2004 1 #2 Salem Programmer Apr 29, 2003 2,455 GB > awk '{ print $1 }' Replace this with Code: awk '{ sum += $1 } END { print sum }' -- Upvote 0 Downvote
Feb 4, 2004 1 #3 PHV MIS Nov 8, 2002 53,708 FR Why not just use awk, like this ? Code: awk -F, ' /savegrp:/{next} /\*/{next} /ngahdsrv:/{sum+=$2} END{print sum} ' deneme Hope This Help PH. Upvote 0 Downvote
Why not just use awk, like this ? Code: awk -F, ' /savegrp:/{next} /\*/{next} /ngahdsrv:/{sum+=$2} END{print sum} ' deneme Hope This Help PH.
Feb 8, 2004 Thread starter #4 ozi403 Technical User Apr 29, 2002 54 TR Hi, All these are helpful. And now I have a new case that's I want to multiply these numbers with 1000.Can you help me? Upvote 0 Downvote
Hi, All these are helpful. And now I have a new case that's I want to multiply these numbers with 1000.Can you help me?
Feb 8, 2004 #5 PHV MIS Nov 8, 2002 53,708 FR Like this ? Code: awk -F, ' /savegrp:/{next} /\*/{next} /ngahdsrv:/{sum+=$2} END{print sum*1000} ' deneme Hope This Help PH. Upvote 0 Downvote
Like this ? Code: awk -F, ' /savegrp:/{next} /\*/{next} /ngahdsrv:/{sum+=$2} END{print sum*1000} ' deneme Hope This Help PH.