3
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?
3
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?
1
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.
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.
One could also check the "Regular Expression" checkbox and type
\t
in the "Find:" textfield and\n
in the "Replace:" textfield. – romainl – 2011-07-08T11:42:26.947Yup, didn't want to include it at first because with Regular expressions you'd have to read up what to use if your separator is not
\t
. I added that to the answer though, thanks for pointing out. – slhck – 2011-07-08T11:52:57.407