Print line if following line is missing
0
votes
4
answers
213
views
This is related to awk print 2 lines back if match but since my command has buffering issues that I'm unable to resolve I think a better approach would be to completely ignore stderr and look for output missing certain lines.
So my output will be:
Gathering drive descriptors ...
Gathering data for drive 0 ...
Drive Model: DataTraveler 2.0
Gathering data for drive 1 ...
Drive name: id1,sd@n5000cca17096
Drive Model: HUH721010AL4204
Drive Speed: 7200 RPMs
Drive Temp: 41 C
Gathering data for drive 2 ...
Drive name: id1,sd@n5000cca24156
Drive Model: HUH721010AL4204
Drive Speed: 7200 RPMs
Drive Temp: 41 C
Gathering data for drive 3 ...
Drive name: id1,sd@n5000cca8749
Drive Model: HUH721010AL4204
Gathering data for drive 4 ...
Drive name: id1,sd@n5000cca19183
Drive Model: HUH721010AL4204
Drive Speed: 7200 RPMs
Drive Temp: 41 C
Gathering data for drive 5 ...
Drive name: id1,sd@n5000cca4607
Drive Model: HUSMH8010BSS204
Gathering data for drive 6 ...
Drive name: id1,sd@n5000cca10152
Drive Model: HUH721010AL4204
Drive Speed: 7200 RPMs
Drive Temp: 41 C
And I would like to output the
Drive name
for any drive missing the Drive Speed
and Drive Temp
lines.
Output should be:
Drive name: id1,sd@n5000cca8749
Drive name: id1,sd@n5000cca4607
This is beyond my capabilities but I'm sure awk
can do it but am not set on using awk
, anything that accomplishes the task will work (don't have GNU tools). Thanks!
Asked by jesse_b
(41447 rep)
Jan 17, 2020, 05:32 PM
Last activity: Jan 19, 2020, 05:27 PM
Last activity: Jan 19, 2020, 05:27 PM