<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>DanNorris.com - Latest Comments in Concatenating lines in ldapsearch results</title><link>http://dannorris.disqus.com/</link><description></description><atom:link href="https://dannorris.disqus.com/concatenating_lines_in_ldapsearch_results/latest.rss" rel="self"></atom:link><language>en</language><lastBuildDate>Mon, 04 Oct 2010 04:21:34 -0000</lastBuildDate><item><title>Re: Concatenating lines in ldapsearch results</title><link>http://www.dannorris.com/2008/09/08/concatenating-lines-in-ldapsearch-results/#comment-83675904</link><description>&lt;p&gt;Many thanks for this post. There's a little problem with this solution. If the ldif is very big the array could collapse the memory. In my case the ldif allocates 70 gb os disk space, so the script with the array crash.&lt;/p&gt;&lt;p&gt;In this case I would prefer this script:&lt;/p&gt;&lt;p&gt;#!/usr/bin/perl&lt;/p&gt;&lt;p&gt;while ($line = &amp;lt;&amp;gt;) {&lt;br&gt;        chomp($line);&lt;br&gt;        if ( $line =~ /^authpassword/ ) {&lt;br&gt;                next;&lt;br&gt;        } elsif ( $line =~ /^\S+/) { ### this line is a "normal" or starting line&lt;br&gt;                print "$complete_line\n";&lt;br&gt;                $complete_line=$line;&lt;br&gt;        } elsif ( $line =~ /^$/ ) { ### this line is blank&lt;br&gt;                print "$complete_line\n";&lt;br&gt;                $complete_line="";&lt;br&gt;        } elsif ( $line =~ /^\s+(\S.*)/ ) { ### this line is a continuation&lt;br&gt;                $line =~ s/^\s+//;&lt;br&gt;                $complete_line=$complete_line . $line;&lt;br&gt;        }&lt;br&gt;}&lt;/p&gt;&lt;p&gt;This script can be run in a pipe, like this:&lt;/p&gt;&lt;p&gt;# gzcat backup_ldif.gz | ./&lt;a href="http://concat_ldif.pl" rel="nofollow noopener" target="_blank" title="concat_ldif.pl"&gt;concat_ldif.pl&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Asier Larrabide</dc:creator><pubDate>Mon, 04 Oct 2010 04:21:34 -0000</pubDate></item><item><title>Re: Concatenating lines in ldapsearch results</title><link>http://www.dannorris.com/2008/09/08/concatenating-lines-in-ldapsearch-results/#comment-13484625</link><description>&lt;p&gt;I was having a problem with this script. It doesn't handle the situation where the continuation line contains spaces. Here's a better version:&lt;/p&gt;&lt;p&gt;$cnt=0;&lt;br&gt;while ($line = &amp;lt;&amp;gt;) {&lt;br&gt;  chomp($line);&lt;br&gt;  if ( $line =~ /^authpassword/ ) {&lt;br&gt;    next;&lt;br&gt;  } elsif ( $line =~ /^\S+/) { ### this line is a "normal" or starting line&lt;br&gt;    $results[$cnt++] = $line;&lt;br&gt;  } elsif ( $line =~ /^$/ ) {  ### this line is blank&lt;br&gt;    $results[$cnt++] = "";&lt;br&gt;  } elsif ( $line =~ /^\s+(\S.*)/ ) {  ### this line is a continuation&lt;br&gt;    $results[$cnt-1] = $results[$cnt-1] . $1;&lt;br&gt;  }&lt;br&gt;}&lt;/p&gt;&lt;p&gt;for $i (0 .. $cnt) {&lt;br&gt;  print "$results[$i]\n";&lt;br&gt;}&lt;br&gt;&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">sbutler</dc:creator><pubDate>Tue, 28 Jul 2009 18:25:41 -0000</pubDate></item><item><title>Re: Concatenating lines in ldapsearch results</title><link>http://www.dannorris.com/2008/09/08/concatenating-lines-in-ldapsearch-results/#comment-8245411</link><description>&lt;p&gt;Glad it was helpful. Thanks for stopping by!&lt;/p&gt;&lt;p&gt;Please excuse my typos, I sent this from my iPhone.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Dan Norris</dc:creator><pubDate>Wed, 15 Apr 2009 20:07:27 -0000</pubDate></item><item><title>Re: Concatenating lines in ldapsearch results</title><link>http://www.dannorris.com/2008/09/08/concatenating-lines-in-ldapsearch-results/#comment-8229772</link><description>&lt;p&gt;So usefull !!!&lt;/p&gt;&lt;p&gt;I got this issue with dipassistant boostrap (line breaks) and incorrect changetype attribute&lt;/p&gt;&lt;p&gt;Thanks Dan !&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">J. Ayme</dc:creator><pubDate>Wed, 15 Apr 2009 12:03:37 -0000</pubDate></item><item><title>Re: Concatenating lines in ldapsearch results</title><link>http://www.dannorris.com/2008/09/08/concatenating-lines-in-ldapsearch-results/#comment-3021071</link><description>&lt;p&gt;Thanks! ...and thanks for stopping by!&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Dan Norris</dc:creator><pubDate>Mon, 13 Oct 2008 08:54:55 -0000</pubDate></item><item><title>Re: Concatenating lines in ldapsearch results</title><link>http://www.dannorris.com/2008/09/08/concatenating-lines-in-ldapsearch-results/#comment-3008133</link><description>&lt;p&gt;Very handy Dan. It hadn't actually occurred to me that you could always use Perl from the Oracle home before - I do often find myself having to do some sort of "munging" across multiple lines and Perl is probably the easiest tool for the job.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Simon Haslam</dc:creator><pubDate>Sun, 12 Oct 2008 11:46:26 -0000</pubDate></item></channel></rss>