Hi ya Urszula
Hope you're well. It doesn't seem that complex.
Are your lines:
u> -3.085902 (1a)
u> -0.40908 (2a)
u> 1.968368 (3a)
u> -3.79142 (4a)
u> -3.79142 (5a)
u> -3.79142 (6a)
u> -1.135603 (1b)
Like in groups of 6 ? Or is that just convient notation ?
A normal awk pattern would pick these up...
#- all
{
if( $2 == "1a" ){
a_total = a_total+$1;
}
else if( ( $2 == "2a" ){
a_total = a_total+$1;
}
else if( $2 == "3a" ){
a_total = a_total+$1;
}
else .... #more sums
}
If you want to refine that like who is a "b" or a "1", etc.
YOU can be pedestrian and use simple C style logic.
(substr($2, 1, 1) == "a"){ # First char of 2nd column
#do stuff
}
Awk is very powerful, etc, etc.... Unless you are investing in a big
code-to-last-7 years kind of thing, why sweat it.
If you are investing in a 10,ooo year project, that's OK too. Make
it work and refine it later.
Aloha,
Will.
--- In geeksthatgawk@yahoogroups.com, "uhg_kwant" <ulka@1...> wrote:
> Hi
>
> Thanks for answering - I kinda desperate!
>
> # delete unimportant lines between regular expressions and
> pipe it to awk
> awk 'NR == 11,NR == 16 {print $4} NR == 25,NR ==30 {print $4} NR ==
> 39,NR== 44 {print $7}'
> # from proper lines print needed column
> done