Plan 9 from Bell Labs’s /usr/web/sources/contrib/quanstro/root/sys/src/cmd/upas/binscripts/tfmt.rc

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


#!/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=]

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.