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?

slhck
  • 235,242
Dan
  • 191

1 Answers1

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)

    enter image description here

  • 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).

enter image description here

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.

enter image description here

slhck
  • 235,242