Hi,
I am trying to write a script that pull three lines from specific entries in a config file. Example: manager.cfg
10000 Service Orange 2.1
MIN=1 MAX=5
START=AUTO
PATH=/user/bin/Orange
10000 Service Orange 2.0
MIN=1 MAX=8
START=MANUAL
PATH=/user/bin/Orange
10000 Service Orange 1.1
MIN=1 MAX=3
START=MANUAL
PATH=/user/bin/Orange
10000 Service Orange 1.0
MIN=1 MAX=5
START=AUTO
PATH=/user/bin/Orange
6346 Service Green 2.0
MIN=1 MAX=3
START=MANUAL
PATH=/user/bin/Green
6346 Service Green 1.1
MIN=1 MAX=3
START=AUTO
PATH=/user/bin/Green
6346 Service Green 1.0
MIN=1 MAX=3
START=MANUAL
PATH=/user/bin/Green
100003 Service Red 1.0
MIN=1 MAX=3
START=MANUAL
PATH=/user/bin/Red
100003 Service Red 1.1
MIN=3 MAX=6
START=AUTO
PATH=/user/bin/Red
The goal is to print the first 3 lines of all the entries that have "START=AUTO". Example:
100003 Service Red 1.1
MIN=3 MAX=6
START=AUTO
Awk worked fine until I needed to do this in *nix and Windows. Perl seems like a good choice, but I'm trying to learn as I go. I can't seem to get the two lines before START=AUTO to print.
Thanks in advance.
Robert
I am trying to write a script that pull three lines from specific entries in a config file. Example: manager.cfg
10000 Service Orange 2.1
MIN=1 MAX=5
START=AUTO
PATH=/user/bin/Orange
10000 Service Orange 2.0
MIN=1 MAX=8
START=MANUAL
PATH=/user/bin/Orange
10000 Service Orange 1.1
MIN=1 MAX=3
START=MANUAL
PATH=/user/bin/Orange
10000 Service Orange 1.0
MIN=1 MAX=5
START=AUTO
PATH=/user/bin/Orange
6346 Service Green 2.0
MIN=1 MAX=3
START=MANUAL
PATH=/user/bin/Green
6346 Service Green 1.1
MIN=1 MAX=3
START=AUTO
PATH=/user/bin/Green
6346 Service Green 1.0
MIN=1 MAX=3
START=MANUAL
PATH=/user/bin/Green
100003 Service Red 1.0
MIN=1 MAX=3
START=MANUAL
PATH=/user/bin/Red
100003 Service Red 1.1
MIN=3 MAX=6
START=AUTO
PATH=/user/bin/Red
The goal is to print the first 3 lines of all the entries that have "START=AUTO". Example:
100003 Service Red 1.1
MIN=3 MAX=6
START=AUTO
Awk worked fine until I needed to do this in *nix and Windows. Perl seems like a good choice, but I'm trying to learn as I go. I can't seem to get the two lines before START=AUTO to print.
Thanks in advance.
Robert