|
|
1.1 ! root 1: #!/bin/rc ! 2: ! 3: switch($#*){ ! 4: case [012] ! 5: echo usage: mkextract [-u] field n file... >[1=2] ! 6: exit 1 ! 7: } ! 8: ! 9: switch($1){ ! 10: case -u ! 11: flag=$1; shift ! 12: case * ! 13: flag='' ! 14: } ! 15: ! 16: field=$1 ! 17: n=$2 ! 18: shift 2 ! 19: ! 20: fn select { ! 21: awk ' ! 22: ! 23: BEGIN { doprint=0 } ! 24: /^$/ { next } ! 25: /^#/ { next } ! 26: doprint && /^[^ ]/ { doprint=0 } ! 27: doprint { print $'^$n^' } ! 28: $0 ~ "^'^$field^'" { doprint=1; next } ! 29: ' $* ! 30: } ! 31: ! 32: switch($flag){ ! 33: case -u ! 34: select $* | sort -u ! 35: case * ! 36: select $* ! 37: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.