Sep 22, 2009 #1 brk6971 Technical User Joined Aug 10, 2007 Messages 9 Location US Have a script that produces the sum of a column of numbers: cat file |awk '{ sum += $1 } END { print sum }' >sum Now I want to divide the sum by 1024 and have the output print on the screen.
Have a script that produces the sum of a column of numbers: cat file |awk '{ sum += $1 } END { print sum }' >sum Now I want to divide the sum by 1024 and have the output print on the screen.
Sep 22, 2009 #2 Annihilannic MIS Joined Jun 22, 2000 Messages 6,317 Location AU No need for cat there. Why not just repeat the command, adjusted slightly, unless of course it's a large input file: Code: awk '{ sum += $1 } END { print sum/1024 }' file Annihilannic. Upvote 0 Downvote
No need for cat there. Why not just repeat the command, adjusted slightly, unless of course it's a large input file: Code: awk '{ sum += $1 } END { print sum/1024 }' file Annihilannic.
Sep 24, 2009 Thread starter #3 brk6971 Technical User Joined Aug 10, 2007 Messages 9 Location US Thanks that worked. The file was not that large. Upvote 0 Downvote