in reply to Re: Match a string that can contain a carriage return in a random position.
in thread Match a string that can contain a carriage return in a random position.

Not a bad suggestion, BUT:

  1. As the file to be read in is so large, it will have to be dealt with line by line.
  2. The lines will break at the 80th position.
  3. Using the /s-switch in the regex will solve nothing as you will only find the newline-character at the end of the line just read in.

I would suggest rather to first normalize the file, i.e. remove the newlines at the 80th positions and concatenating the various parts of each DN together so as to have one line per DN.

Then you can use the regex /cn=(.+),ou=(.+),ou=(.+),c=(.+)/

Finally you de-normalize the DN's again by adding -if necessary- newlines at position 80 so as no to break the other tools.

CountZero

"If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law

  • Comment on Re: Re: Match a string that can contain a carriage return in a random position.