- AuthorPosts
- August 7, 2019 at 5:58 am #26086DavidParticipant
I have some data like the following(about 200 lines in one file):
Breaker Mininature Circuit Breaker
Breaker Air Circuit Breaker
Breaker Vacumm Circuit Breaker
Contactor DC Contactor
Contactor AC Contactor
………………..
I can view this data in TSV mode( tab-delimiter) and try to add some sequential number for second column, but I don’t know if possible to finish quickly. Wanted data is:
Breaker 01_Mininature Circuit Breaker
Breaker 02_Air Circuit Breaker
Breaker 03_Vacumm Circuit Breaker
Contactor 01_DC Contactor
Contactor 02_AC Contactor
………………..
Wish your suggestion.August 10, 2019 at 2:36 am #26087LTTParticipantMy steps are not quick enough, but a macro or Excel won’t be more convenient/flexible as far as I know.
(Use “Quick Launch” if you can not find the commands used below.)TSV mode.
Select column 1 (by clicking the Column Header above the Ruler).
Copy it. (“Copy Column(s)” command also can be used, when the selection is not the whole column(s).)
Paste it into a new tab.—————
Now in the new tab:Find:
^(.+)\n(?!\1)(.+\n)
Replace with:
\1\n\n\2
▲ To insert an empty line between each two groups.TSV mode.
Select the 2nd (empty) column (by clicking the Column Header above the Ruler).Numbering: (Enable these 2 options)
Skip Empty Lines.
Restart Numbering after Empty Lines.After the numbers are added, press “_”.
Delete column 1. (Now only the number_ column remains.)
Use “Remove Empty Lines” command.
Select the column (by clicking the Column Header above the Ruler).
Copy it. (Or use “Copy Column(s)” command.)—————
Now go back to the previous tab:TSV mode.
Position the caret after the 1st tab character. (= before “Mini…”)
Paste.August 10, 2019 at 3:49 am #26089DavidParticipantHello,LTT, Thanks for your help. I will try to use a macro to solve it!
- AuthorPosts
- You must be logged in to reply to this topic.