Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2011-08-11 22:19:47

Destry
Member
From: Haut-Rhin
Registered: 2004-08-04
Posts: 4,909
Website

text file editing wizardry

I have a text file that is a busload of URLs, all strung together in one continuous block and separated only by a comma. How can I quickly turn the commas into line breaks?

I’ve tried TextMate but don’t seem to be able to do it. I’ve tried importing into a spreadsheet but the commas are treaded like column separators when what I’m really after is a single column of URLs (each to it’s own row).

I suspect command-line is the answer, but I’m many years removed from emacs, etc.

Suggestions?

Offline

#2 2011-08-11 22:24:14

net-carver
Archived Plugin Author
Registered: 2006-03-08
Posts: 1,648

Re: text file editing wizardry

Guessing that TextMate has a find and replace that can do , -> \r (assuming \r is indeed the right line break on a mac.)


Steve

Offline

#3 2011-08-11 22:32:46

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: text file editing wizardry

Replacing , with \n works for me.

Offline

#4 2011-08-11 22:39:47

Destry
Member
From: Haut-Rhin
Registered: 2004-08-04
Posts: 4,909
Website

Re: text file editing wizardry

Strange, not working for me. Steve’s example just replaces the comma with \r. And Els’ example inserts the \n after the comma, even though it’s a find/replace. Still using TextMate, btw.

Offline

#5 2011-08-11 22:43:11

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: text file editing wizardry

I don’t know TextMate, but what also works in a text editor is to copy a line break and paste it into the ‘replace with’ field.

Offline

#6 2011-08-11 22:46:46

Destry
Member
From: Haut-Rhin
Registered: 2004-08-04
Posts: 4,909
Website

Re: text file editing wizardry

Bingo! Thanks Els.

Offline

Board footer

Powered by FluxBB