#! /bin/sh grep '^....7.-..[02468]' "$@"
#! /bin/sh sed "s-^$HOME-~-" "$1" >"$1.bak" && mv "$1.bak" "$1"tai
#! /bin/sh awk '{ sub("^'$HOME'","~"); print }' "$1" >"$1.bak" && mv "$1.bak" "$1"
#! /bin/sh for i in *.cc ;do [ -f "$i" ] && mv "$i" "${i%.cc}.C" ;donetai
#! /bin/sh ls *.cc | sed 's/\(.*\)\.cc$/mv \1.cc \1.C/' | sh
#! /bin/sh grep -En '\[(a-z|A-Z|a-zA-Z)\]' /dev/null "$@"
#! /bin/sh find "$@" -type f -exec grep -l Pekka {} \;tai
#! /bin/sh find "$1" -type f | xargs grep -l Pekka
#! /bin/sh while IFS=: read login pw uid gid gcos home shell do ls -ld "$home"/ | awk '$3 != "'$login'" || $1 ~ /d...(.w....|.....w.)/' done </etc/passwd
#! /bin/awk -f BEGIN { n=ARGV[1] f="%4d" if (ARGV[2]=="8") f="%4o" if (ARGV[2]=="16") f="%4X" ARGC=1 for (i=1; i<=n; ++i) { for (j=1; j<=n; ++j) printf f, i*j printf "\n" } }
#! /bin/awk -f ! cols { cols=NF } { if (NF != cols) exit diagsum1 += $NR diagsum2 += $(NF-NR+1) for (i=0; i++<NF;) { rowsum[NR]+=$i colsum[i]+=$i } } END { if (!cols) { printf "empty file has no magic\n"; exit 1 } if (NR!=cols) { printf "not square, no magic\n"; exit 2 } for (i in rowsum) { if (rowsum[i] != rowsum[1]) { printf "row %d fails, bad magic\n", i; exit 3 } if (colsum[i] != colsum[1]) { printf "column %d fails, bad magic\n", i; exit 4 } } if (diagsum1!=diagsum2) { printf "diagonals disagree, bad magic\n"; exit 5 } print "magic it is!" }