The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #3 (permalink)  
Old 06-20-2009
radoulov's Avatar
radoulov radoulov is offline Forum Staff  
addict
  
 

Join Date: Jan 2007
Location: Варна, България / Milano, Italia
Posts: 2,859
Use gawk, nawk or /usr/xpg4/bin/awk on Solaris:

1.

Code:
awk '/<OKAY>/ { 
  sub(/>[^>]*$/, "")
  n = split($0, t, "/")
  print t[n]   
  }' infile
2.

Code:
awk '!NF { f = 0 }
/^!ENTRY.*<INFO>/ {
  sub(/>[^>]*$/, "")
  sub(/.*RESOURCE: /, "")
  print; f = 1
  }  
f && /!SUBENTRY/ { f++ }   
f > 1 && sub(/!MESSAGE /, "")
' infile

Last edited by radoulov; 06-20-2009 at 10:48 AM..
Bits Awarded / Charged to radoulov for this Post
Date User Comment Amount
06-22-2009 hareeshram Thanks for the smart solution! 200