The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #2 (permalink)  
Old 11-21-2007
vgersh99's Avatar
vgersh99 vgersh99 is offline Forum Staff  
Moderator
  
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 5,131
something along these lines.....
nawk -f noa.awk myFile

noa.awk:

Code:
BEGIN {
  FS="( |:|=)"
  FLDidx=4
  FLDname=5
}

{
  if ( $FLDname == "state" && $NF == "6" )
     state6[$FLDidx]
  if ( $FLDname == "sessionID" )
     sessionID[$FLDidx] = $NF
}
END {
  for (i in state6)
    printf("state6 idx->[%d] sessionID->[%d]\n", i, sessionID[i])
}