shithub: 9intro

ref: a351bcdccdf5a4273bc8dc3360a48fbb8b8aa9ea
dir: /idx/range.prep/

View raw version
#!/bin/rc
awk ' # range.prep
#   Input:  ["%begin"|"%end"|""] string (tab) number
#   Output: string (tab) ["b"|"e"|"a"]  (tab) number

BEGIN		{ FS = OFS = "\t" }
		{ f2 = "a" }
$1 ~ /^%begin/	{ f2 = "b"; sub(/^%begin */, "", $1) }
$1 ~ /^%end/	{ f2 = "e"; sub(/^%end */, "", $1) }
		{ print $1, f2, $2 }
' $*