Anyone knows how would one merge such list as
item 1 item 2
item 3 item 4
to
item 1
item 2
item 3
item 4
in TextMate or TextWrangler?
How are the columns separated? By a \t
? If so, you just want to replace this with a newline. If they aren't separated by a tab, the procedure is the same – just copy the column separator, whatever it is. Two spaces for example should work just fine, as will a ,
when working witha CSV.
item 1 item 2
item 3 item 4
The procedure's fairly easy:
Copy the tab character from the text field with Cmd-C (it might help to have View → Show Invisibles enabled)
Open a search/replace window with Cmd+F.
Paste the copied tab character into the "Find" field with Cmd-V.
In the "Replace" field, press alt+Enter to get a new line.
It'll look like this (yes, you can't see anything, but you can select the contents to see everything's there).
Then, click "Replace All". Result:
item 1
item 2
item 3
item 4
As @romainl points out, it's also possible to use Regular Expressions for that. If you know the separator is Tab (\t
), just check "Regular expression" and enter \t
for "Find" and \n
for "Replace.
\t
in the "Find:" textfield and \n
in the "Replace:" textfield.
\t
. I added that to the answer though, thanks for pointing out.