shithub: riscv

ref: 20a1d2268d69a0bbe66d0f21999649133878377c
dir: /sys/src/cmd/upas/binscripts/tfmt.rc/

View raw version
#!/bin/rc
# anti-topposting defense

# sed '/^[ 	]*>[ 	]*>[ 	]*>/q'

awk '
{
	if(l[i] ~ /^[ 	]*>[ 	]*>[ 	]*>/)
		q = 1
	if(q == 0)
		l[i = NR] = $0;
}
END{
	for(; i > 1; i--)
		if(l[i] !~ /^([ 	]*>)*[ 	]*$/)
			break;
	for(; i > 1; i--)
		if(l[i] !~ /^[ 	]*>[ 	]*>/)
			break;
	for(; i > 1; i--)
		if(l[i] !~ /^([ 	]*>)*[ 	]*$/)
			break;
	for(j = 1; j <= i; j++)
		print l[j]
}' |dd -conv block >[2=]