SUBFILTER=$SRCDIR/scripts/subfilter.sh
UNDIFFFILTER=$SRCDIR/scripts/undiff.sh
CONFFILTER=$SRCDIR/scripts/conf.sh
+STRIPATTR=$SRCDIR/scripts/stripattr.sh
SLAPADD="../servers/slapd/tools/slapadd $LDAP_VERBOSE"
SLAPCAT="../servers/slapd/tools/slapcat $LDAP_VERBOSE"
add: member
member: cn=Dorothy Stevens, ou=Alumni Association, ou=People, o=University of Michigan, c=US
member: cn=James A Jones 1, ou=Alumni Association, ou=People, o=University of Michigan, c=US
+-
+replace: description
+description: A very long description, that is very likely to cause line wrapping in a LDIF file
+-
dn: cn=All Staff,ou=Groups,o=University of Michigan,c=US
changetype: modify
LDIF=$SLAVEOUT
echo "Filtering master ldapsearch results..."
-. $LDIFFILTER < $SEARCHOUT | egrep -iv ^description > $SEARCHFLT
+. $LDIFFILTER < $SEARCHOUT | $STRIPATTR "description" > $SEARCHFLT
echo "Filtering slave ldapsearch results..."
. $LDIFFILTER < $LDIF > $LDIFFLT
SEARCHOUT=$MASTEROUT
echo "Filtering remaining data"
-. $LDIFFILTER < $SEARCHOUT | egrep -iv ^description > $SEARCHFLT
+. $LDIFFILTER < $SEARCHOUT | $STRIPATTR "description" > $SEARCHFLT
echo "Stripping slave entries from master output..."
-$CMP $SEARCHFLT $LDIFFLT | $UNDIFFFILTER > $SUBFLT
+$DIFF $SEARCHFLT $LDIFFLT | $UNDIFFFILTER > $SUBFLT
echo "Stripping subtree entries from master output..."
. $SUBFILTER 'ou=Groups,[ ]?o=University of Michigan,[ ]?c=US' < $SEARCHOUT \
- | $UNDIFFFILTER | egrep -iv ^description > $SUBFLT2
+ | $STRIPATTR "description" > $SUBFLT2
echo "Comparing master minus subtree and master minus slave..."
$CMP $SUBFLT $SUBFLT2 > $CMPOUT
#! /bin/sh
#
-# Expunge "< " and "> " resulting from diff
+# Expunge extra stuff resulting from diff -u
+# strip everything, including leading '-', except leading '+' to force errors
#
-awk '!/^[0-9]/ {print $0}' | \
- sed "s/^< \|^> \|^- \|^+ //" | \
- awk '/.+/ {print $0}'
-
+awk '/^-/ {if (substr($0,1,3) != "---") print substr($0,2,length($0))} /^+/ {if (substr($0,1,3) != "+++") print $0}'