Text manipulation for Windows
September 27, 2005 5:24 PM   Subscribe

Can anybody recommend a text manipulation tool for Windows, similar to SPROG?

I'm need to do a bit of text manipulation, including the normalisation of a rather large list of URLs.
posted by jedro to Computers & Internet (7 answers total)
 
Don't know what SPROG is, but, you can't beat perl for text manipulation.
posted by singingfish at 9:06 PM on September 27, 2005


Hard to say from the limited task description you've given , but PowerGREP might work for you. SPROG seems like a GUI Perl script generator, and that's great if you want to do Perl hacks without knowing Perl, but it might be overkill for what you are trying to do.
posted by paulsc at 9:26 PM on September 27, 2005


The canonical answer would have to be sed. You need to learn general expressions, but the syntax is many times simpler than perl (although it's one way to work your way toward perl, PHP, or Python).

Many of the tricks you learn with sed are also applicable to other GNU and general-expression-based utilities, including the vi editor.
posted by dhartung at 10:13 PM on September 27, 2005


Response by poster: Okay, here's some additional information.

I have a list of urls, in a number of forms. The three main types are:

http://www.b.com
http://www.a.b.com
http://b.com

I want to remove all the extraneous "www"s

So the above URLs should be converted to :

http://b.com
http://a.b.com
http://b.com
posted by jedro at 12:32 AM on September 28, 2005


If that is all you are looking for, any simple Windows text editor with a batch 'find & replace' function would work. Textpad would fill the bill, and has a full function "evaluation" license. Even Notepad for Windows XP has this functionality, and works as follows. (Textpad also does regex, in case you need something more powerful than simple find & replace, and can save files with Unix style newlines, etc.)

Make a work copy of your file. On the edit menu, select "Replace" to bring up the Replace dialog. In the "find" field put (without the angle brackets) and in the "replace" field, put (also without the angle brackets. Hit the "Replace all" button on the right. Voila!

I did exactly this with your examples cut and pasted into Textpad, and it works fine.

posted by paulsc at 4:55 AM on September 28, 2005


Doh, angle brackets as delimiters aren't displayed in comments...

in the find field put: http://www.
in the replace field put: http://
posted by paulsc at 4:57 AM on September 28, 2005


Ultraedit is a great editor and supports regular expressions in find & replace. Not free but worth it, I think.
posted by phearlez at 7:21 AM on September 28, 2005


« Older Worst. Question. Ever.   |   You say tomatillo, I say tummyache Newer »
This thread is closed to new comments.