TrofoNeni to zadnej zazrak, ale funguje mi to :)
#!/bin/bash
USAGE="$0 file1 file2"
TMPDIR="/tmp"
TMPFILE1="$TMPDIR/inidiff.tmp.1"
TMPFILE2="$TMPDIR/inidiff.tmp.2"
SECTIONRE='^[[:space:]]*\[([^]]*)\][[:space:]]*$'
SECTIONRE2='^[[:space:]]*\[[^]]*\][[:space:]]*$'
set -e
if [ ! -f "$1" ] || [ ! -f "$2" ]; then
echo "$USAGE" >&2
fi
echo -n > "$TMPFILE1"
echo -n > "$TMPFILE2"
cat "$1" \
| sed -nr "s/$SECTIONRE/\1/p" \
| sort -u \
| while read section; do
echo "[$section]" >> "$TMPFILE1"
cat "$1" \
| sed -nr "/\[$section\]/,/$SECTIONRE/p" | grep -v "$SECTIONRE2" | grep -v '^$' | sort >> "$TMPFILE1"
done
cat "$2" \
| sed -nr "s/$SECTIONRE/\1/p" \
| sort -u \
| while read section; do
echo "[$section]" >> "$TMPFILE2"
cat "$2" \
| sed -nr "/\[$section\]/,/$SECTIONRE/p" | grep -v "$SECTIONRE2" | grep -v '^$' | sort >> "$TMPFILE2"
done
diff "$TMPFILE1" "$TMPFILE2"
|