Textpattern Forum

You are not logged in. Register | Login | Help

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

Destry
Moderator
From: Strasbourg, France
Registered: 2004-08-04
Posts: 2,361
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
Admin
From: UK
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
Textile | My plugins on GitHub | @netcarver

Offline

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

Els
Admin
From: The Netherlands
Registered: 2004-06-06
Posts: 7,388
Website

Re: text file editing wizardry

Replacing , with \n works for me.


<txp:Els /> ;)
Tag Reference | Unexpected behaviour? Check the tag trace | Still no clue? Check the names of your custom fields

Offline

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

Destry
Moderator
From: Strasbourg, France
Registered: 2004-08-04
Posts: 2,361
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
Admin
From: The Netherlands
Registered: 2004-06-06
Posts: 7,388
Website

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.


<txp:Els /> ;)
Tag Reference | Unexpected behaviour? Check the tag trace | Still no clue? Check the names of your custom fields

Offline

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

Destry
Moderator
From: Strasbourg, France
Registered: 2004-08-04
Posts: 2,361
Website

Re: text file editing wizardry

Bingo! Thanks Els.

Offline

Board footer

Powered by FluxBB