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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Whats wrong in this "awk" command

Status
Not open for further replies.

kishorerk

Programmer
Jan 25, 2003
2
US
(/usr/lib/lpd/pio/etc/piolsvp -q 2>&1| sort | awk '$0 !~ /^#/ { if ( $1 ~ /^A/ || /^O/ || /^R/ || /^S/ ) { { if ($1 ~ /-$SYS3D_DC_SITE:).*)?$/)
print $1 ; else next } } print $1 }' 2>&1)
Output
-----------
OLB2-DV08
OLB2-DV09
U4910
u4812

Should be:
---------
A045-DV08
A045-DV09
OLB2-DV08
OLB2-DV09
U4910
u4812

Whats wrong in the above "awk" command -
The first "if command" misses the first search pattern "A"

Kindly help, im a starter with the awk programming.

Thanks in advance!!
 
Post a sample of your input file - it'll help us see what you've got to work with. Dickie Bird (:)-)))
 
if ( $1 ~ /^A/ || $1 ~ /^O/ || $1 ~ /^R/ || $1 ~ /^S/ ) -----------
Ohne Intelligenz bist Du ein Fiasko,
ohne Technik ein Amateur und
ohne Herz eine Maschine.

[ Wladimir Horowitz ]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top