File: myuniq.awk

package info (click to toggle)
eprover 2.6%2Bds-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 21,288 kB
  • sloc: ansic: 331,111; csh: 12,026; python: 10,178; awk: 5,825; makefile: 461; sh: 389
file content (27 lines) | stat: -rwxr-xr-x 363 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/opt/local/bin/gawk -f

# Usage: myuniq.awk file 
#
# Copyright 1998 Stephan Schulz, schulz@informatik.tu-muenchen.de
#
# Read file line by line, return the first line of each set with the
# same $1. Comments (line with #) are passed on unmodified!
#

BEGIN{
   key = "";
}

/#/{
   print;
   next;
}

{
   if($1!=key)
   {
      print;
      key = $1;
   }
}