Page 1 of 1
Moving a line, before another line
Posted: Fri Feb 13, 2009 7:31 pm
by kkruk_Work
Lets say I have this:
Name1
Data1
Data2
Data3
Name2
Data1
Data2
Name3
Data4
Data3
Data1
And so on and so forth. The number of data elements varies.
The output I am looking for is:
Name1,Data1
Name1,Data2
Name1,Data3
Name2,Data1
Name2,Data2
Name3,Data4
Name3,Data3
Name3,Data1
Is this doable?
Posted: Sat Feb 14, 2009 12:09 am
by Bob Hansen
For four line samples:
Search for: \n\n(.*)\n(.*)\n(.*)\n(.*)\n\n
Replace with: \n\n\1,\2\n\1,\3\n\1,\4\n\n
For three line samples:
Search for: \n\n(.*)\n(.*)\n(.*)\n\n
Replace with: \n\n\1,\2\n\1,\3\n\n
No time to work on this any more right now, hope this gets you started.
May need to insert a few blank lines at the top to make sure you have \n\n at the beginning.
It looks like you may need to separate three line and four line groups. With a little more work this can probably be made as an OR statement to handle both 3 and 4 lines groups in the same document.
Replace Next vs. Replace All may work at this point, but need to do multiple passes for each group size.
Use the following settings:
-----------------------------------------
[X] Regular expression
-----------------------------------------
Configure | Preferences | Editor
[X] Use POSIX regular expression syntax
-----------------------------------------
Posted: Mon Feb 16, 2009 4:48 pm
by kkruk_Work
Thank you very much.
