]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Parsing the output of ldapsearch with a perl script to unfold lines and make it compa...
authorrgrosso <rgrosso@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 28 Jan 2008 14:01:16 +0000 (14:01 +0000)
committerrgrosso <rgrosso@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 28 Jan 2008 14:01:16 +0000 (14:01 +0000)
SHUTTLE/schema_prod/unfoldlines.pl [new file with mode: 0755]
SHUTTLE/schema_prod/verify.sh

diff --git a/SHUTTLE/schema_prod/unfoldlines.pl b/SHUTTLE/schema_prod/unfoldlines.pl
new file mode 100755 (executable)
index 0000000..ae6d561
--- /dev/null
@@ -0,0 +1,29 @@
+#!/usr/bin/perl
+# unfoldlines.pl is a script to unfold lines when they start with a leading
+# space. It is meant to correct the output of ldapsearch making it comparable
+# to the ldif files 
+# Usage: ldapsearch [...args...] | ./unfoldlines.pl > verify.out
+# if verify.out is the file to be diffed against the ldif files
+# 
+
+my @lines=<>;
+
+$folded=0;
+$cnt=1;
+while ($lines[$cnt]) {
+  $line = $lines[$cnt];
+  if ($line =~ /^ /) {
+    $folded = 1;
+    $line =~ s/^ //;
+    chomp $lines[$cnt-1];
+    $line = $lines[$cnt-1] . $line;
+    print $line;
+  } else {
+    if($folded==0) {print $lines[$cnt-1];}
+    $folded=0;
+  }
+  $cnt++;
+}
+
+close(FILE);
+
index 4d3a96813506aefec5f5d0c2468c063fbeb0f58c..122fcefe165c04c0fa0921bbff843ece2f56a1c6 100755 (executable)
@@ -27,6 +27,8 @@ case "$1" in
 esac
 
 ldapsearch -H ldap://pcalishuttle01.cern.ch  -x -b "$SEARCH,o=shuttle_prod,dc=cern,dc=ch" -L -L -L > verify.out
+cat verify.out | ./unfoldlines.pl > verify1.out
 
-diff --ignore-space-change --ignore-blank-lines verify.out $FILE | grep -v "> #"
+diff --ignore-space-change --ignore-blank-lines verify1.out $FILE | grep -v "> #" | grep -v '^0[a-z]'
 
+rm verify.out verify1.out