Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I print from one word to the end of the line? 2

Status
Not open for further replies.

jdespres

MIS
Aug 4, 1999
230
US
I would like to print out $5 $9 and all the way from "WRN" to the end of the line from the following data:

1238509302 1 4 8 Server1 2759827 2759827 0 Server2 bpbrm from client Server2: WRN - can't open object: Shadow Copy Components:
\System Service\Windows Management Instrumentation\WMI (BEDS 0xFFFFFEC2: )

awk '{print $5, $9, ??????}'

Thanks.....

Joe Despres
 
Tried it out:

bperror -hoursago 24 | grep -i beds |awk '{w=$0; sub(/.*WRN/,"WRN",w); print $5, $9, w}'
awk: syntax error near line 1
awk: illegal statement near line 1

Joe Despres
 
what about this ?
awk '/WRN/{sub(/^.*: WRN /,$5" "$9" WRN ",$0);print $0}'

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Tried the last one...

bperror -hoursago 24 | grep -i beds |awk '/WRN/{sub(/^.*: WRN /,$5" "$9" WRN ",$0);print $0}'
awk: syntax error near line 1
awk: illegal statement near line 1

Joe Despres
 
Don't you have nawk or gawk ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
aaaahhhhh.....

Solaris 9....

I tried with nawk instead of awk....

And it worked!!!

Thanks...

Joe Despres
 
Both of these command given did the same thing! Now I wish I had enough grey matter to interpret them!

Thanks!

Joe Despres
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top