Awk

Show ASCII table
BEGIN { for (i=0; i<16; i++) { for (j=32+i; j<128; j+=16) { if (j == 32) { x = "SPC" } else if (j == 127) { x = "DEL" } else { x = sprintf("%c",j) } printf("%3d: %-5s",j,x) }      print "" } }
 * 1) Usage: awk -f showascii

Tally up a column of figures
case "$1" in [1-9]*) colnum="$1"; shift;;  *) echo "Usage: `basename $0` colnum [files]" 1>&2; exit 1;; esac awk '{sum += $col} END {print sum}' col=$colnum OFMT='%.2f' ${1+"$@"}
 * 1) ! /bin/sh

Use awk to list the thirty most-common words in a text file
{  nbytes += length($0) + 2 # +2 for CR/LF nfields += NF    $0 = tolower($0) for (i=1; i<=NF; i++) { arr[$i]++ } } END { show = (show == "") ? 30 : show width1 = length(show) PROCINFO["sorted_in"] = "@val_num_desc" for (i in arr) { if (width2 == 0) { width2 = length(arr[i]) } if (n++ >= show) { break } printf("%*d %*d %s\n",width1,n,width2,arr[i],i) }    printf("input: %d records, %d bytes, %d words of which %d are unique\n",NR,nbytes,nfields,length(arr)) exit(0) }
 * 1) Usage: awk -f wordfreq textfile.txt