help-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

joining records depending on special conditions - a job for gawk?


From: olli
Subject: joining records depending on special conditions - a job for gawk?
Date: 18 Aug 2005 03:14:39 -0700
User-agent: G2/0.2

Hello

for special purposes I "constructed" a TAB-delimited text file - here a
little excerpt with fieldnames:

mainno    subno   asciino(a)   asciino(b)   ...
000027    00      66           69
000027    00      66           69
000027    00      66           69
000035    00      154          100
000035    00      154          100
000035    00      154          114
...

For every distinct combination of mainno & subno I need a count of the
occurences of asciino(a..NF) in a special range (e.g.: count only if $X
between 128 and 255 and not in (196,225))

the result should look like

mainno    subno   COUNT
000027    00      5
000035    00      19
000426    01      0
000701    03      77
...

I don't want to use a database for this!
I know how to solve this problem if I had mainno & subno (eg. 000027
00) only on one line as $1 & $2 followed by the contents of all
asciino-fields belonging to this combination of mainno & subno.

Any ideas how to get rid of this problem?

Thanks in advance

oliver



reply via email to

[Prev in Thread] Current Thread [Next in Thread]