1#!/sw/bin/gawk -f 2 3# Usage: myuniq.awk file 4# 5# Copyright 1998 Stephan Schulz, schulz@informatik.tu-muenchen.de 6# 7# Read file line by line, return the first line of each set with the 8# same $1. Comments (line with #) are passed on unmodified! 9# 10 11BEGIN{ 12 key = ""; 13} 14 15/#/{ 16 print; 17 next; 18} 19 20{ 21 if($1!=key) 22 { 23 print; 24 key = $1; 25 } 26} 27 28