~dricottone/my-utils

ref: 276445b8cea1f67b788dcfc599f68b2467d40c46 my-utils/src/start-at -rwxr-xr-x 381 bytes
276445b8Dominic Ricottone Added networking scripts (i.e. vpn*); Updated style of most scripts 3 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/awk -f

# start-at
# ===========
# Usage: <command> | start-at -v pattern='^-+$'
#
# After a pattern is matched, re-print.

BEGIN {
  if (pattern == "" || inclusive !~ /^[01]?$/) {
    print "Usage: start-at -v pattern=PATTERN -v inclusive=0|1"
    exit 1
  }
  matched=0
}
{
  if (matched==1) print;
  if ($0 ~ pattern) {
    matched=1;
    if (inclusive==1) print;
  }
}