I have tables like this in a log file. I am looking for a way to grab out certain lines and add a sentence behind it relating to my server that it was down in within my unix box. Is that possible ?
If I use this command I can get the all the DOWNs on my table "grep DOWN file" now I also want which mdserver it was down at also. My first thought was to use the -B switch in grep to do this. However that isn't going to work as mdserver* can't be expected certain lines above the "DOWN" item. Any suggestions ? Thank you.
My table in log file
mdserver10
Corn UP 0 0
Bacon UP 54 0
Water DOWN 0 0
Fries UP 746 0
Turkey UP 0
mdserver11
Water DOWN 0 0
Fries UP 746 0
Turkey UP 0
mdserver12
Corn DOWN 0 0
Bacon UP 54 0
Water UP 0 0
Fries UP 746 0
My expected results.
Water DOWN 0 0 is down on mdserver10
Water DOWN 0 0 is down on mdserver11
Corn DOWN 0 0 is down on mdnserver12
</table><table border="1" style="width:300px">mdserver10 </tr>
<tr><td style="width:310px"> Water </td><td bgcolor ="red"> DOWN </td><td style="width:50px"> 0 </td><td style="width:50px"> </tr> </td></tr>