awk issue

Hi all,

i am trying to use below command to see the output of hardware inventory, but i only see 2 first line no output of the command.

awk '/Hardware/ {print $0}' XXX_result.txt 
Hardware inventory:
Hardware inventory:

any idea how to see whatever is under hardware inventory.

i will really appreciate your help!

jared

Can you please post the content of XXX_result.txt and also post the desired output you want from this file?

There is maybe nothing more...

your question is not clear, r u trying to to search string hardware in given input file XXX_result.txt ? or just want to display everything in file XXX_result.txt
?

i like to see output under hardware inventory which is like below...but you can see it only shows Hardware inventory line and thats it!

 
Item             Version  Part number  Serial number     Description
Chassis                                D3636             M320
Midplane         REV 08   710-009120   TS0977            M320 Midplane
FPM GBUS         REV 05   710-005928   XW5987            M320 Board
FPM Display      REV 05   710-009351   XS5720            M320 FPM Display
CIP              REV 05   710-005926   XW6402            M320 CIP
PEM 0            Rev 08   740-009148   VK57595           DC Power Entry Module
PEM 1            Rev 08   740-009148   VK57527           DC Power Entry Module
PEM 2            Rev 08   740-009148   VK57533           DC Power Entry Module
PEM 3            Rev 08   740-009148   VK57532           DC Power Entry Module
Routing Engine 0 REV 09   740-014082   9009041642        RE-A-2000

Jared, please post your data samples in code tags.
By the way I don't see string: Hardware anywhere in the data sample you posted. So if you search for string: Hardware using awk, it will print only that particular line.

so can you tell me if this is even posisble how to see line below hardware uisng awk?

Yes, this is possible. If you want just the next line, you can use getline, E.g.

# cat infile
Hardware
Line no: 1
Line no: 2
Line no: 3
# awk '/Hardware/ { print; getline; print; } ' infile
Hardware
Line no: 1

But if you want a range of line to be printed, then you have to specify that.

Hardware inventory:
Item             Version  Part number  Serial number     Description
Chassis                                D3636             M320
Midplane         REV 08   710-009120   TS0977            M320 Midplane
FPM GBUS         REV 05   710-005928   XW5987            M320 Board
FPM Display      REV 05   710-009351   XS5720            M320 FPM Display
CIP              REV 05   710-005926   XW6402            M320 CIP
PEM 0            Rev 08   740-009148   VK57595           DC Power Entry Module
PEM 1            Rev 08   740-009148   VK57527           DC Power Entry Module

Jared.

Please watch this video on how to use code tags.

The code tag button has changed and looks different in the video, but it's in the same place, next to the quote tag:

The code tag button now looks like:

And then reread the rules you agreed to when you registered, and then I will unlock your account.

Thank you.

thanks and it did solve part of my problem:) can you suggest how to specify line in awk..i cant seem to find it , played around for hrs but not getting desrired result.

 awk '/Hardware/ {print; getline;print; } ' xxx.txt

thanks!

I must just be imagining it.