Regex (or whatever) help please



  • Hi all,
    I am stuck trying to get the last step in the re-formatting of this file and I am hoping there is a way (other than RBAR manual processing) to accomplish this. What I have is this sort of thing:


    GEASLER
    SARA L GEASLER,

    SHERMAN
    MATTHEW J SHERMAN,


    Which I would like to eliminate the blank lines and combine the other two as so:
    GEASLER, SARA L GEASLER,
    SHERMAN, MATTHEW J SHERMAN,

    I have tried and failed at all I knew and tried a few things I didn’t, no joy in Mudville. If someone could give me a push in the right direction I would greatly appreciate it.



  • @craig-white

    Let’s get some joy back in Mudville before the big strikeout.

    It appears your data can be thought of as three lines per person, the first two lines with data, the third line as empty. This is the best I can assume from what you’ve shown. If that is true, and assuming Windows line endings of CR+LF are desired, then…

    Find what box: (?-s)(.+?)\r\n(.+?)\r\n\r\n
    Replace with box: \1,\x20\2\r\n
    Search mode: Regular expression

    …should take you a long way.



  • Thank you very much, I will get done what the boss wants and then com back and figure out how and why it worked. Always good to understand something better. Thanks again!


Log in to reply