Plan 9 from Bell Labs’s /usr/web/sources/contrib/steve/rc/whitewash

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


#!/bin/rc
# whitewash - sort /mail/grey/whitelist by reversed domain name

rfork en

fn revdom {
	awk '
	{ 
		printf("%-24s", $1);
		n = split($2, a, ".");
		if (n > 0){
			printf(" %s", a[n]);
			for (i = n-1; i > 0; i--)
				printf(".%s", a[i]);
		}
		if (NF >= 3)
			printf("\t\t");
		for (i = 3; i <= NF; i++)
			printf(" %s", $i);
		printf("\n");
	}
	' $*
}

{ grep -v '^[ \t]*$' $* | revdom  | sort -f -b +1 | revdom ; echo '' }

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].