[SWLUG] adding up columns

Dick Porter dick at acm.org
Sat Dec 13 10:09:52 UTC 2003


On Fri, 2003-12-12 at 21:41, Bryn Reeves wrote:
> You can do this with sed & awk, it takes about 30s on my PIV celeron to 
> process a 60Mb file. Just put the script in a file & make it executable:
> 
> 
> 	SED_STRIP="s/,/ /g"
> 
> 	cat $@ | sed "$SED_STRIP" | awk "$AWK_SUM" 

You can lose the cat and sed parts by setting the field separator to ','
and letting awk open the files itself:

awk -F, "$AWK_SUM" $@

- Dick





More information about the Swlug mailing list