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 -->
  #5 (permalink)  
Old 09-01-2008
user_prady user_prady is offline
Registered User
  
 

Join Date: Sep 2007
Posts: 163
Quote:
Originally Posted by Annihilannic View Post
Something like this? (not tested much)


Code:
awk '
        /TXADDR/ { txaddr=$NF }
        /RXADDR/ { rxaddr=$NF }
        /TXDATA/ { txdata[txaddr,++txindex[txaddr]]=$NF }
        /RXDATA/ {
                if ($NF != txdata[rxaddr,++rxindex[rxaddr]]) {
                        print "rxdata " $NF " for address " rxaddr " does not match transmitted: " txdata[rxaddr,rxindex[rxaddr]]
                }
        }
' inputfile
Thanks genious Annihilannic .. Really appriciate your logic..

Can You Please give a brief idea what does this statement for

Code:
txdata[txaddr,++txindex[txaddr]]

I guess this is a 2D array but when I print that only it gives me error.

Regards,
user_prady

Last edited by user_prady; 09-01-2008 at 03:29 AM..