Some tips about awk

user-pic
Vote 0 Votes

Get the sum of single column
cat a.txt
26.2578125
126.023438
705.6875
6000
7849.08594
15260
35243.3125
88700
378483
Usage: cat a.txt|awk '{(tot+=$1)};END{ print tot}'

Get the sum of each column
cat b.txt
111781888     2564208
111781888     21437296
39077120      21338848
111781888     3138160
111781888     17370216
111781888     9237336
111781888     3484016
111781888     3068568
Usage: cat b.txt| awk '{(tot+=$1) (tot2+=$2)};END{print tot, tot2}'

No TrackBacks

TrackBack URL: http://www.isoracle.com/mt/mt-tb.cgi/4

Leave a comment

About this Entry

This page contains a single entry by Joe Wang published on September 29, 2007 12:16 AM.

ORA 600 error during 10g(10203) standby recovery was the previous entry in this blog.

Powered by FreeBSD now! is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.