THIS IS THE CODE I AM USING. I AM RUNNING AWK ON SGI IRIX.
{if ( $1~/@NAME/ && $2~/ASalarm_HBT_SS/ ) {a=$2} {t1=1}}
{if ( /@ENABLE_LIMITS:/ ) {b=$0} {t2=1}}
{if (t1==1 && t2==1) printf "%s %s", FILENAME " " a, b "\n"}
{a=""} {b=""} {t1=0} {t2=0}
{if (/@FMT/) {printf "\n" "NEXT PARAM" "\n\n" }}
THESE ARE THE RESULTS I AM GETTING
(The "NEXT PARAM" statement only helps me see I am getting output
from every single data file record. I am only using it for debugging.
It is not necessary for the final code)
ws20 21% awk -f parsrch3.awk data.file
small.txt
small.txt
small.txt
small.txt
small.txt
small.txt
small.txt
small.txt @ENABLE_LIMITS: NO
small.txt
small.txt
small.txt
small.txt
small.txt
small.txt
small.txt
small.txt
NEXT PARAM
small.txt
small.txt
small.txt
small.txt
small.txt
small.txt
NEXT PARAM
small.txt
small.txt ASalarm_HBT_SS
small.txt
small.txt
small.txt @ENABLE_LIMITS: NO
small.txt
small.txt
small.txt
small.txt
small.txt
small.txt
small.txt
small.txt
NEXT PARAM
small.txt
small.txt
small.txt
small.txt
small.txt @ENABLE_LIMITS: NO
small.txt
small.txt
small.txt
small.txt
small.txt
small.txt
small.txt
small.txt
NEXT PARAM
ws20 22%
I WOULD LIKE TO GET THE RESULTS IN TWO FLAVORS:
(DESIRED OUTPUT 1)
THESE ARE THE RESULTS I WANT
ws20 21% awk -f parsrch3.awk data.file
small.txt ASalarm_HBT_SS
small.txt @ENABLE_LIMITS: NO
(DESIRED OUTPUT 2)
AND IN SOME CASES THESE ARE THE RESULTS I WOULD LIKE
ws20 21% awk -f parsrch3.awk data.file
small.txt ASalarm_HBT_SS @ENABLE_LIMITS: NO
THIS IS THE DATA
ws20 31% cat data.file
@VERSION_NUM: 1.11
@JITTER_VAL: 55 @MATH_TRIG: NONE
@NAME: ASalarm_HB @STREAM: 1
@DESC: PAM VEH alarm BH @UNITS: BL
@DATAQ_CC
@ENABLE_LIMITS: NO
@PROC_LOC: FRONT END @FEND_NO: 1 @TIME_FMT: BINARY
@RAW_COMP: NONE
@RAW_CONV: IEEE FP
@EU_CAL: NULL
@EU_COMP: NONE
@YEL_LO: -7.5e+05 @YEL_HI: 7.5e+05 @RED_LO: -7.5e+05 @RED_HI: 7.5e+05
@DYN_LIMS: INACTIVE
@FMT: FLOAT @RES: 3
@NAME: ASalarm_HBT_CS @STREAM: 2
@DESC: PAM VEH alarm BH ENABLE CMD ST @UNITS: CMD ST
@DATAQ_CC
@EU_CAL: NULL
@FMT: FLOAT @RES: 3
@NAME: ASalarm_HBT_SS @STREAM: 1
@DESC: PAM VEH alarm BH SCRIPT STATUS @UNITS: DSRT
@DATAQ_CC
@ENABLE_LIMITS: NO
@PROC_LOC: FRONT END @FEND_NO: 1 @TIME_FMT: BINARY
@RAW_COMP: NONE
@RAW_CONV: IEEE FP
@EU_CAL: NULL
@EU_COMP: NONE
@YEL_LO: -7.5e+05 @YEL_HI: 7.5e+05 @RED_LO: -7.5e+05 @RED_HI: 7.5e+05
@DYN_LIMS: INACTIVE
@FMT: FLOAT @RES: 3
@NAME: ASalarm_STALL @STREAM: 1
@DESC: PAM VEH alarm BH FAILURE STATUS @UNITS: BL
@DATAQ_CC
@ENABLE_LIMITS: NO
@PROC_LOC: FRONT END @FEND_NO: 1 @TIME_FMT: BINARY
@RAW_COMP: NONE
@RAW_CONV: IEEE FP
@EU_CAL: NULL
@EU_COMP: NONE
@YEL_LO: -7.5e+05 @YEL_HI: 7.5e+05 @RED_LO: -7.5e+05 @RED_HI: 7.5e+05
@DYN_LIMS: INACTIVE
@FMT: FLOAT @RES: 3
{if ( $1~/@NAME/ && $2~/ASalarm_HBT_SS/ ) {a=$2} {t1=1}}
{if ( /@ENABLE_LIMITS:/ ) {b=$0} {t2=1}}
{if (t1==1 && t2==1) printf "%s %s", FILENAME " " a, b "\n"}
{a=""} {b=""} {t1=0} {t2=0}
{if (/@FMT/) {printf "\n" "NEXT PARAM" "\n\n" }}
THESE ARE THE RESULTS I AM GETTING
(The "NEXT PARAM" statement only helps me see I am getting output
from every single data file record. I am only using it for debugging.
It is not necessary for the final code)
ws20 21% awk -f parsrch3.awk data.file
small.txt
small.txt
small.txt
small.txt
small.txt
small.txt
small.txt
small.txt @ENABLE_LIMITS: NO
small.txt
small.txt
small.txt
small.txt
small.txt
small.txt
small.txt
small.txt
NEXT PARAM
small.txt
small.txt
small.txt
small.txt
small.txt
small.txt
NEXT PARAM
small.txt
small.txt ASalarm_HBT_SS
small.txt
small.txt
small.txt @ENABLE_LIMITS: NO
small.txt
small.txt
small.txt
small.txt
small.txt
small.txt
small.txt
small.txt
NEXT PARAM
small.txt
small.txt
small.txt
small.txt
small.txt @ENABLE_LIMITS: NO
small.txt
small.txt
small.txt
small.txt
small.txt
small.txt
small.txt
small.txt
NEXT PARAM
ws20 22%
I WOULD LIKE TO GET THE RESULTS IN TWO FLAVORS:
(DESIRED OUTPUT 1)
THESE ARE THE RESULTS I WANT
ws20 21% awk -f parsrch3.awk data.file
small.txt ASalarm_HBT_SS
small.txt @ENABLE_LIMITS: NO
(DESIRED OUTPUT 2)
AND IN SOME CASES THESE ARE THE RESULTS I WOULD LIKE
ws20 21% awk -f parsrch3.awk data.file
small.txt ASalarm_HBT_SS @ENABLE_LIMITS: NO
THIS IS THE DATA
ws20 31% cat data.file
@VERSION_NUM: 1.11
@JITTER_VAL: 55 @MATH_TRIG: NONE
@NAME: ASalarm_HB @STREAM: 1
@DESC: PAM VEH alarm BH @UNITS: BL
@DATAQ_CC
@ENABLE_LIMITS: NO
@PROC_LOC: FRONT END @FEND_NO: 1 @TIME_FMT: BINARY
@RAW_COMP: NONE
@RAW_CONV: IEEE FP
@EU_CAL: NULL
@EU_COMP: NONE
@YEL_LO: -7.5e+05 @YEL_HI: 7.5e+05 @RED_LO: -7.5e+05 @RED_HI: 7.5e+05
@DYN_LIMS: INACTIVE
@FMT: FLOAT @RES: 3
@NAME: ASalarm_HBT_CS @STREAM: 2
@DESC: PAM VEH alarm BH ENABLE CMD ST @UNITS: CMD ST
@DATAQ_CC
@EU_CAL: NULL
@FMT: FLOAT @RES: 3
@NAME: ASalarm_HBT_SS @STREAM: 1
@DESC: PAM VEH alarm BH SCRIPT STATUS @UNITS: DSRT
@DATAQ_CC
@ENABLE_LIMITS: NO
@PROC_LOC: FRONT END @FEND_NO: 1 @TIME_FMT: BINARY
@RAW_COMP: NONE
@RAW_CONV: IEEE FP
@EU_CAL: NULL
@EU_COMP: NONE
@YEL_LO: -7.5e+05 @YEL_HI: 7.5e+05 @RED_LO: -7.5e+05 @RED_HI: 7.5e+05
@DYN_LIMS: INACTIVE
@FMT: FLOAT @RES: 3
@NAME: ASalarm_STALL @STREAM: 1
@DESC: PAM VEH alarm BH FAILURE STATUS @UNITS: BL
@DATAQ_CC
@ENABLE_LIMITS: NO
@PROC_LOC: FRONT END @FEND_NO: 1 @TIME_FMT: BINARY
@RAW_COMP: NONE
@RAW_CONV: IEEE FP
@EU_CAL: NULL
@EU_COMP: NONE
@YEL_LO: -7.5e+05 @YEL_HI: 7.5e+05 @RED_LO: -7.5e+05 @RED_HI: 7.5e+05
@DYN_LIMS: INACTIVE
@FMT: FLOAT @RES: 3