May 29, 2014

Sed?awk? What command should I use?

Hello, I have an output text file extracted by ldapsearch that has a wrong format due 80 columns limitation. What I need now is a command that could bring the wrapped lines back to the correct sequence (see below): dn: cn=epz0016,ou=Contractors,ou=People,o=acme$ ACL: 6#entry#cn=epz0016,ou=Contractors,ou=People,o=acme#loginScript$ ACL: 6#entry#cn=epz0016,ou=Contractors,ou=People,o=acme#printJobConfiguration$ SecurityEquals: o=acme$ SecurityEquals: cn=acme,cn=DFS Management,cn=Role Based Service 2,ou=services,$ o=acme$ I found some posts related to sed and awk commands, but I didn't get to find the correct command to fix the output file. As you can see, in the wrapped lines we have a "$" in the end of the line and a " " (space) in the beginning of the sequence. I would like to have the line below: SecurityEquals: cn=acme,cn=DFS Management,cn=Role Based Service 2,ou=services,$ o=acme$ like this: SecurityEquals: cn=acme,cn=DFS Management,cn=Role Based Service 2,ou=services,o=acme$ Could somebody help me? Thanks,

Click Here!