View Single Post
  #5   (View Single Post)  
Old 19th March 2009
J65nko J65nko is offline
Administrator
 
Join Date: May 2008
Location: Budel - the Netherlands
Posts: 4,128
Default

Something like this?
Code:
$ cat test-case.txt

1       2       a       b
1       2       c       d
1       2       e       f
1       3       a       b
1       3       c       d

$ cat gosha-awk                                
#!/usr/bin/awk -f

BEGIN {
col_1_prev = ""
col_2_prev = ""
}

{
if ( $1 == col_1_prev  &&  $2 == col_2_prev )  
  printf "\t\t%s\t%s\n", $3, $4  
else
  printf "%s\t%s\t%s\t%s\n", $1, $2, $3, $4 

col_1_prev = $1
col_2_prev = $2
}

$ ./gosha-awk test-case.txt  
1       2       a       b
                c       d
                e       f
1       3       a       b
                c       d
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump
Reply With Quote