I can't seem to hurtle creating a file with variable number of joins (line concatenation) - I can do this in a macro in vi but haven't mastered joining in an awk script with more than one line joining at a time.
the script needs to:
search for ^STARTRECORD and append each line following that begins with ^ JOINRECORD
INPUT
STARTRECORD 49035063810000 PT 001 OIL ISIP 5900
JOINRECORD MIN/ 5800
STARTRECORD 49035063810000 PT 002 OIL, ISIP 5700
STARTRECORD 49035063810000 PT 005 GAUGES NOT MCFD-1540 MCFD
STARTRECORD 49035063810000 PT 003 FLOWED
JOINRECORD 887 BY END OF TEST, STABALIZED AT 768 MCFD
JOINRECORD ACT W/GEL DIESEL-FLUSHED W/9660 GALS CLEAR DIESEL ISIP
JOINRECORD 5200 SIP /15 MINS/ 5000 FLOWED 1020 MCFD DECR TO 362 MCFD
OUTPUT SHOULD LOOK LIKE:
STARTRECORD 49035063810000 PT 001 OIL ISIP 5900 JOINRECORD MIN/ 5800
STARTRECORD 49035063810000 PT 002 OIL, ISIP 5700
STARTRECORD 49035063810000 PT 005 GAUGES NOT MCFD-1540 MCFD
STARTRECORD 49035063810000 PT 003 FLOWED JOINRECORD 887 BY END OF TEST, STABALIZED AT 768 MCFD JOINRECORD ACT W/GEL DIESEL-FLUSHED W/9660 GALS CLEAR DIESEL ISIP JOINRECORD 5200 SIP /15 MINS/ 5000 FLOWED 1020 MCFD DECR TO 362 MCFD
This is a simplified file. In reality, I will not need the STARTRECORD AND jOINRECORD IN THE FINAL FILE; HOWEVER, IT WAS EASIER FOR ME TO SCRIPT IT IN AT THIS POINT. ( I was using sed to strip the final file)
Thanks,
And while I'm at it - How about a good "basics" awk book?
Thanks again
the script needs to:
search for ^STARTRECORD and append each line following that begins with ^ JOINRECORD
INPUT
STARTRECORD 49035063810000 PT 001 OIL ISIP 5900
JOINRECORD MIN/ 5800
STARTRECORD 49035063810000 PT 002 OIL, ISIP 5700
STARTRECORD 49035063810000 PT 005 GAUGES NOT MCFD-1540 MCFD
STARTRECORD 49035063810000 PT 003 FLOWED
JOINRECORD 887 BY END OF TEST, STABALIZED AT 768 MCFD
JOINRECORD ACT W/GEL DIESEL-FLUSHED W/9660 GALS CLEAR DIESEL ISIP
JOINRECORD 5200 SIP /15 MINS/ 5000 FLOWED 1020 MCFD DECR TO 362 MCFD
OUTPUT SHOULD LOOK LIKE:
STARTRECORD 49035063810000 PT 001 OIL ISIP 5900 JOINRECORD MIN/ 5800
STARTRECORD 49035063810000 PT 002 OIL, ISIP 5700
STARTRECORD 49035063810000 PT 005 GAUGES NOT MCFD-1540 MCFD
STARTRECORD 49035063810000 PT 003 FLOWED JOINRECORD 887 BY END OF TEST, STABALIZED AT 768 MCFD JOINRECORD ACT W/GEL DIESEL-FLUSHED W/9660 GALS CLEAR DIESEL ISIP JOINRECORD 5200 SIP /15 MINS/ 5000 FLOWED 1020 MCFD DECR TO 362 MCFD
This is a simplified file. In reality, I will not need the STARTRECORD AND jOINRECORD IN THE FINAL FILE; HOWEVER, IT WAS EASIER FOR ME TO SCRIPT IT IN AT THIS POINT. ( I was using sed to strip the final file)
Thanks,
And while I'm at it - How about a good "basics" awk book?
Thanks again