summaryrefslogtreecommitdiff
path: root/nocompile/bin/XuntilY.awk
blob: 6334d3190a440568c03214981ebbb4937631a945 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/bin/sh
if [ "_$3" = "_" ];then
 count=1
else
 count="$3"
fi
awk '
BEGIN {counter='$count'}
/'$1'/, /'$2'/{
  print $0;
  if($0 ~ /'$2'/) {
    counter--;
  }
  if(counter == 0) {nextfile}
}
'