#!/usr/bin/awk -f # G.R.I.D.S.'ify ur text for great justice # (c) 2006 vxp -- contact me at bantown or ircnet # # fallback if the supplied message is shorter than 5 characters $0 !~ /^...../ { print "\0035G.\0037R.\0038I.\0039D.\0032S. \00313\037/\\"; } # G.R.I.D.S.'ify /^...../ { # color pattern array colors[1]="\00304"; # bright red colors[2]="\00307"; # dark yellow colors[3]="\00308"; # bright yellow colors[4]="\00309"; # bright green colors[5]="\00312"; # dark blue # local variables current_n=1; curent_color=current_ch=0; message_str=$0; message_len=length($0); while(current_n <= message_len) { $current_ch=substr(message_str, current_n, 1); if($current_ch !~ /[ ]/) { current_color++; if(current_color > 5) current_color=1; if($current_ch !~ /[!@#$%^&*()_+={}|\\\/?<>.,:;'"`~]/ && $current_ch !~ /[-\[]/ && $current_ch !~ /\]/) { # is it just me or does awk fkn fail at regex printf("%s%s.", colors[current_color], $current_ch); } else { printf("%s%s", colors[current_color], $current_ch); } } else { printf("%s", $current_ch); } current_n++; } printf(" \00313\037/\\\n"); } a