#!/bin/sh if [ -z "$1" -a -z "$2" ]; then echo "Usage: $0 " exit 64 fi perl=`which perl` if [ -z "$perl" ]; then echo "Error: perl is required to run this program" exit 70 fi c1="/tmp/config1.tmp" c2="/tmp/config2.tmp" run1() { if [ ! -r "$1" ]; then echo "Cant read config$2: $1" exit 66 fi #egrep -v '^\s*#|^\s*$' "$1" | sort -b -k1 -k2 > "$3" #egrep -v '^\s*#|^\s*$' "$1" | sed -e 's/\s+/ /g' | sort -b -k1 -k2 > "$3" || exit 2 #egrep -v '^\s*#|^\s*$' "$1" | perl -e '@I=<>; for(@I){s/^\s*//}; sub k{$_=shift;s/\s+/ /g;$_}; @O=sort {k($a) cmp k($b)} @I; print @O' > "$3" || exit 69 egrep -v '^[:blank:]*#|^[:blank:]*$' "$1" | perl -e '@I=<>; for(@I){s/^\s*//}; sub k{$_=shift;s/\s+/ /g;$_}; @O=sort {k($a) cmp k($b)} @I; print @O' > "$3" || exit 69 } run1 "$1" 1 "$c1" run1 "$2" 2 "$c2" chmod 666 "$c1" "$c2" ( echo "--- $1" echo "+++ $2" diff -uw "$c1" "$c2" ) | less -Si