Ok I want to awk certain parts of a file based on whether or not they have certain words. I'll post an example of my file.
**********************
Server1
**********************
Current System Uptime " 6 day(s), 21 hour(s), 13 minute(s), 35 second(s)"
--------------------------------------------------------------------------------
Since 9/22/2004
Total Reboots 12
Mean Time Between Reboots 16.51 days
Total Bluescreens 0
Notes
There is insufficient data in the event log to calculate
system availability. Please see UPTIME /help for more detail.
**********************
Server2
**********************
Current System Uptime " 254 day(s), 0 hour(s), 32 minute(s), 9 second(s)"
--------------------------------------------------------------------------------
Since 4/14/2003
System Availability 99.97%
Total Uptime 724d 21h 51m 14s
Total Downtime 0d 4h 24m 59s
Total Reboots 22
Mean Time Between Reboots 32.96 days
Total Bluescreens 0
That's part of my file. First I awk between Server1 and Blue screens to return all those lines and put them in a file server1.txt. This is where I'm having the trouble. I need it to first do a command like:
and if it doesn't find Availability it will do this:
I'm sorry if this is a simple question I just started using unix utilities and am trying to teach myself.
Thanks
**********************
Server1
**********************
Current System Uptime " 6 day(s), 21 hour(s), 13 minute(s), 35 second(s)"
--------------------------------------------------------------------------------
Since 9/22/2004
Total Reboots 12
Mean Time Between Reboots 16.51 days
Total Bluescreens 0
Notes
There is insufficient data in the event log to calculate
system availability. Please see UPTIME /help for more detail.
**********************
Server2
**********************
Current System Uptime " 254 day(s), 0 hour(s), 32 minute(s), 9 second(s)"
--------------------------------------------------------------------------------
Since 4/14/2003
System Availability 99.97%
Total Uptime 724d 21h 51m 14s
Total Downtime 0d 4h 24m 59s
Total Reboots 22
Mean Time Between Reboots 32.96 days
Total Bluescreens 0
That's part of my file. First I awk between Server1 and Blue screens to return all those lines and put them in a file server1.txt. This is where I'm having the trouble. I need it to first do a command like:
Code:
awk '/Availability/,/Bluescreens/' server1.txt
Code:
awk '/Reboots/,/Bluescreens/' server1.txt
I'm sorry if this is a simple question I just started using unix utilities and am trying to teach myself.
Thanks