| z.entropic 2008-01-24, 7:02 pm |
| On Jan 24, 2:41=A0pm, Ed Morton <mor...@lsupcaemnt.com> wrote:
> On 1/24/2008 1:19 PM, z.entropic wrote:
> <snip>
>
>
2008 19:55 6 =A0 =A0 =A0 1 =A0 =A0 =A0 0 =A0 =A0 =A0 0 =A0 =A0 =A0 3.293 =A0=
1.287[color=darkred]
2008 19:55 6 =A0 =A0 =A0 1 =A0 =A0 =A0 0 =A0 =A0 =A0 0 =A0 =A0 =A0 3.296 =A0=
1.288[color=darkred]
=A0 =A0 =A0 1 =A0 =A0 =A0 0 =A0 =A0 =A0 -0.00185954 =A0 =A0 3.167 =A0 1.287=
[color=darkred]
>
>
> Try this:
>
> awk '($6=3D=3D7)&& (p6=3D=3D6){array1[++n]=3Dp3;array2[n]=3
Dp11} {p=3D$6;p3=
=3D$3;p11=3D$11}' file
>
> You should use an array for the "p" (previous) field values if you to need=
to
> access more of them.
>
> =A0 =A0 =A0 =A0 Ed.
I think my example is a bit confusing due to poor formatting (copying
from Excel with the wrong date format didn't help...) In essence, I
can't get the script working even after some changes etc., so let me
explain again as best as I can. Here is an interesting section frm
one of my data files, this time with proper formatting that awk would
see (tab-separated fields):
100 24479.32 14399.08 1/23/2008 7:55:39 PM 6 1 0 0 3.293399
101 24480.25 14400.01 1/23/2008 7:55:40 PM 6 1 0 0 3.293234
102 24480.36 0.10 1/23/2008 7:55:41 PM 7 1 0 -0.00185954 3.166826
103 24480.46 0.21 1/23/2008 7:55:41 PM 7 1 0 -0.00185932 3.034836
Simply put, I want to find pairs of lines in which the counter in
field $7 changes, here from 6 to 7, and then store in array array1[1]
the value found in field $11 (3.293234, line 101). The next pair of
found lines would change the array counter to 2 (array[2]).
Once I figure out with your help how to do that, I'll try to expand
this script to store more values, including some from line 102 in the
example above.
z.e.
|