Feb
06
I’m a command line junkie who only turns to higher level scripting when
a line of piped together commands falls short. A common task that I run
into is summing a column of data from a text file. Typically, my data
is in a gnuplot friendly format makes extracting the column easy:
grep -v "^#" bandwidth.dat | cut -f3 -d' '
Now what is an easy way to sum that data? I’ve seen solutions using
awk, but I’m not much of an awk fan. Much more exciting is a version
using paste:
grep -v "^#" bandwidth.dat | cut -f3 -d' ' | paste -sd + | bc
no comment untill now