1828789 Members
2843 Online
109985 Solutions
New Discussion

pharser lines in file

 
SOLVED
Go to solution
Jairo Campana
Trusted Contributor

pharser lines in file

Hi , I have this file contains:

portState: 1 Online
portPhys: 6 In_Sync
portScn: 32 F_Port
port generation number: 700
portId: 335700
portIfId: 43820035
portWwn: 20:57:00:05:1e:36:0c:ac
portWwn of device(s) connected:
10:00:00:00:c9:38:3e:59

I need extract for pattern portWwn , the folloging lines :

10:00:00:00:c9:38:3e:59

and the port this a state :Online

my script contain.
awk 'NR > 5 {if ($3=="Online") {print "StatusPort", $3}}' stat
legionx
2 REPLIES 2
James R. Ferguson
Acclaimed Contributor
Solution

Re: pharser lines in file

Hi Jairo:

Based on the data you show:

# awk '/port.*connected/ {getline;print};{if ($3=="Online") {print "StatusPort", $3}}' file

StatusPort Online
10:00:00:00:c9:38:3e:59

Regards!

...JRF...
Jairo Campana
Trusted Contributor

Re: pharser lines in file

thanks , excelent!!!
legionx