openldap/tests/scripts/acfilter.sh

23 lines
841 B
Bash
Raw Normal View History

1999-04-21 01:59:01 -04:00
#! /bin/sh
1999-09-01 20:52:43 -04:00
# $OpenLDAP$
2003-11-28 15:00:23 -05:00
## This work is part of OpenLDAP Software <http://www.openldap.org/>.
##
2008-01-07 19:19:56 -05:00
## Copyright 1998-2008 The OpenLDAP Foundation.
2003-11-28 15:00:23 -05:00
## All rights reserved.
##
## Redistribution and use in source and binary forms, with or without
## modification, are permitted only as authorized by the OpenLDAP
## Public License.
##
## A copy of this license is available in the file LICENSE in the
## top-level directory of the distribution or, alternatively, at
## <http://www.OpenLDAP.org/license.html>.
1999-09-01 20:52:43 -04:00
#
2008-08-26 17:48:17 -04:00
# Strip comments, sort attributes. Requires GNU awk
1999-09-01 20:52:43 -04:00
#
2008-08-26 17:48:17 -04:00
if [ "$BACKEND" != ndb ]; then
grep -v '^#'
2008-08-26 17:48:17 -04:00
else
grep -v '^#'| awk 'BEGIN{FS="\n";RS=""} {j=0; for (i=1; i<=NF; i++){ if ($i ~ /^ /){ x[j] = x[j] "\n" $i; } else { j++; x[j] = $i } } print x[1]; delete x[1]; j=asort(x); for (i=1; i<=j; i++){ print x[i]; } delete x; print "" }'
fi