madasafish
Technical User
I have "week" file with $1 in a series.
Example week file
042007|27/06-21:52:35|27/06-21:52:38|27/06-21:52:41|66
032007|27/06-21:52:35|27/06-21:52:38|27/06-21:52:41|66
022007|27/06-21:52:35|27/06-21:52:38|27/06-21:52:41|66
012007|27/06-21:52:36|27/06-21:52:38|27/06-21:52:41|66
522006|27/06-21:52:36|27/06-21:52:38|27/06-21:52:41|66
512006|27/06-21:52:36|27/06-21:52:38|27/06-21:52:41|66
502006|27/06-21:52:36|27/06-21:52:38|27/06-21:52:41|66
~ $1 is the key field of interest
~ this bit cut out
082006|27/06-21:52:37|27/06-21:52:40|27/06-21:52:43|65
072006|27/06-21:52:37|27/06-21:52:40|27/06-21:52:43|65
062006|27/06-21:52:37|27/06-21:52:40|27/06-21:52:43|65
052006|27/06-21:52:37|27/06-21:52:40|27/06-21:52:43|65
042006|27/06-21:52:37|27/06-21:52:40|27/06-21:52:43|65
I want to supply a begin week and end week
and then print all weeks in order between and including the
the begin and end weeks.
Example nawk english code:
STARTWK=042006
ENDWK=042007
nawk -v startwk=$STARTWK -v endwk=$ENDWK '{
if ($1 ~ startwk)
print $1 and every other $1 up until and including endwk
}' weekfile > newfile
Madasafish
Example week file
042007|27/06-21:52:35|27/06-21:52:38|27/06-21:52:41|66
032007|27/06-21:52:35|27/06-21:52:38|27/06-21:52:41|66
022007|27/06-21:52:35|27/06-21:52:38|27/06-21:52:41|66
012007|27/06-21:52:36|27/06-21:52:38|27/06-21:52:41|66
522006|27/06-21:52:36|27/06-21:52:38|27/06-21:52:41|66
512006|27/06-21:52:36|27/06-21:52:38|27/06-21:52:41|66
502006|27/06-21:52:36|27/06-21:52:38|27/06-21:52:41|66
~ $1 is the key field of interest
~ this bit cut out
082006|27/06-21:52:37|27/06-21:52:40|27/06-21:52:43|65
072006|27/06-21:52:37|27/06-21:52:40|27/06-21:52:43|65
062006|27/06-21:52:37|27/06-21:52:40|27/06-21:52:43|65
052006|27/06-21:52:37|27/06-21:52:40|27/06-21:52:43|65
042006|27/06-21:52:37|27/06-21:52:40|27/06-21:52:43|65
I want to supply a begin week and end week
and then print all weeks in order between and including the
the begin and end weeks.
Example nawk english code:
STARTWK=042006
ENDWK=042007
nawk -v startwk=$STARTWK -v endwk=$ENDWK '{
if ($1 ~ startwk)
print $1 and every other $1 up until and including endwk
}' weekfile > newfile
Madasafish