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?
Moving a line, before another line
Moderators: AmigoJack, bbadmin, helios, MudGuard
- Bob Hansen
- Posts: 1516
- Joined: Sun Mar 02, 2003 8:15 pm
- Location: Salem, NH
- Contact:
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
-----------------------------------------
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
-----------------------------------------
Hope this was helpful.............good luck,
Bob
Bob