File parsing
- From: vibgyorbits <bkajey@xxxxxxxxx>
- Date: Thu, 29 Nov 2007 13:35:51 -0800 (PST)
10 abc
20 abcc
30 abcd
40 xycz
42 wxy
5 abc
20 abcd
30 abcc
So, What i intend to do is:
Build an array or associatiave array...
such as
During the first pass:
search for the "FIRST" occurances of column 2.
So it would be:
"abc" - 10
"abcc" - 20
"abcd" - 30
& so on...
During the second pass:
search for the "SECOND" occurance of column2 & modify the earlier
array as:
"abc" 10 - 5 = "abc" 5
abcc 20 - 30 = "abcc" -10
I know this is doable in just one pass,but i'm stuck at:
1. I read the ffirst occurance of "abc" (column 2) - abc 10
2. I can NOT read until the next occurance ot "abc"- abc 5
3. I can NOT come back a LINE after where i was at step 1.
Is there a better / quicker way to do this?
PS # this is not a homework question, nor this is a puzzle / interview
qn. :)
thanks in advance!
.
- Follow-Ups:
- Re: File parsing
- From: Ed Morton
- Re: File parsing
- Prev by Date: Re: awk math results differ from other languages
- Next by Date: Re: File parsing
- Previous by thread: awk math results differ from other languages
- Next by thread: Re: File parsing
- Index(es):
Relevant Pages
|