in reply to Reformat command output inline

Just a small fix needed:
perl -p0e 's/\n^$|^dn:.*\n//mg; s/cn: //g; s/\norclnetdescstring: /=/g +'

Main problems:

Newline removed after, not before | | | | v v 's/\n^$|\n^dn:*$//mg','s/cn: //g','s/\norclnetdescstring: /=/g' 's/\n^$|^dn:.*\n//mg; s/cn: //g; s/\norclnetdescstring: /=/g ^ ^ | | Missing | dot Optional: no need to switch between Perl and shell +, using semicolons instead of commas.
($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,

Replies are listed 'Best First'.
Re^2: Reformat command output inline
by RenMcCourtey (Acolyte) on Jun 29, 2016 at 13:48 UTC
    Thank you, this not only does what I need but also helps me understand syntax better. Just one more question, if you don't mind. I understand why newline should be at the end of the dn: line now (e.g. first line) but why empty line also can't be like that?
      It can, i.e. you can start the regex with s/^\n| , but it doesn't change the output. Moving the newline to the end for the dn: line was essential to make it work for the first record.

      ($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,
        I see, I have to remove endline $. Well, it was more regex question. Thanks again for taking time to answer.