Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to read first 10 lines then print output then read second 10 lines

Status
Not open for further replies.

netbackup1234

Programmer
Aug 27, 2006
24
US
I have file with following contents..This one is small file. I have big file with simila entry.

Policy Domain Name: EXCGN_TDP01
Schedule Name: BRWSMXSUSR02_T1
Node Name: BRWSMXSUSR02_T1
Scheduled Start: 11/11/2006 18:10:00
Actual Start:
Completed:
Status: Future
Result:
Reason:

Policy Domain Name: EXCGN_TDP01
Schedule Name: BRWSMXSUSR02_T2
Node Name: BRWSMXSUSR02_T2
Scheduled Start: 11/11/2006 18:20:00
Actual Start:
Completed:
Status: Future
Result:
Reason:

I want output as shown below. Any body can help me how to get this using awk ?

upd sched EXCGN_TDP01 BRWSMXSUSR02_T1 startt=18:10:00
upd sched EXCGN_TDP01 BRWSMXSUSR02_T2 startt=18:20:00
 
One way:
awk '
/Policy/{p=$NF}
/Node/{n=$NF}
/Scheduled Start/{s=$NF}
/Reason/{printf "upd sched %s %s startt=%s\n",p,n,s}
' /path/to/input > output

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top