Hi all:
Been banging my head on this one and I can't find the right touch.
I have output from a command that produces the following format;
Handle
another line
another line
another line
Handle
System Information
line 1
line 2
line 3
line 4
Handle
another line
another line
another line
another line
Handle
etc...
What I am wanting to do is print everything between the lines of Handle but only if the pattern of System Information is matched. The rest of the data I do not want.
I did come up with this and it works OK, but I know there is a better solution.
awk 'BEGIN { RS = "System Information" } END { RS = "" } {print $1, $2, $3, "\n" $4, $5, $6}'
Like I said, this works OK but if the number of variables/lines changes then the print changes. What I really want is to print all lines (line 1, line 2, line 3 line n, ...) regardless of the number of lines.
The shell can be either ksh or bash.
Many thanks