#!/bin/sh
#
# Linux-only:
# Combine 2 lines of DN ldif, if necessary ; ldapsearch output that
# we're using is very verbose, so we don't have to worry about the
# 2nd line if its not a continuation
#
IFS=""
while read x; do
  echo $x | egrep '^dn:' > /dev/null 2>&1
  if [ $? -eq 0 ]; then
    read y
    echo "$y" | egrep '^ ' > /dev/null 2>&1
    if [ $? -eq 0 ]; then
      y=`echo "$y"|sed 's/ //'`
      echo "$x$y"|sed -e 's/dn: //'
    else
      echo "$x"|sed -e 's/dn: //'
    fi
  fi
done
