Mass Search and Replace?

Discuss programming topics for the various GPL'd game engine sources.
Baker
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Mass Search and Replace?

Post by Baker »

I'm restructuring the global variables.

Any decent text editors that you can setup a table with 2 columns to do a batch search and replace?

Manual search and replaces are subject to human error and I have about 70 to do.
The night is young. How else can I annoy the world before sunsrise? 8) Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
behind_you
Posts: 237
Joined: Sat Feb 05, 2011 6:57 am
Location: Tripoli, Libya

Post by behind_you »

notepad ++ has find and replace in files function. Very time saving, and it has many options such as filters and which directory to search.
Baker
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Post by Baker »

I already have singular replace in all files. I need something that do 70+ replaces with like 2 columns. Otherwise it'll take maybe an hour. :D
The night is young. How else can I annoy the world before sunsrise? 8) Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
Baker
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Post by Baker »

I was hoping for something open source or something built-in to one of the more notable text editors like Notepad++ or UltraEdit or such.

But this is gonna have to do ... http://www.replsoft.com/replacer.html
The night is young. How else can I annoy the world before sunsrise? 8) Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
behind_you
Posts: 237
Joined: Sat Feb 05, 2011 6:57 am
Location: Tripoli, Libya

Post by behind_you »

www.replsoft.com/replacer.html

Havent tried this but its what you are looking for. Tell me if it works.
behind_you
Posts: 237
Joined: Sat Feb 05, 2011 6:57 am
Location: Tripoli, Libya

Post by behind_you »

Baker wrote:I was hoping for something open source or something built-in to one of the more notable text editors like Notepad++ or UltraEdit or such.

But this is gonna have to do ... http://www.replsoft.com/replacer.html
U beat me to it...
Baker
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Post by Baker »

That tool is actually rather sophisticated. It's not bad. I'd still prefer a built-in plug-in for a well-known text editor, but it is getting the job done.
The night is young. How else can I annoy the world before sunsrise? 8) Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
Spirit
Posts: 1068
Joined: Sat Nov 20, 2004 9:00 pm
Contact:

Post by Spirit »

You could write a macro for JEdit.
Improve Quaddicted, send me a pull request: https://github.com/Quaddicted/quaddicted-data
Baker
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Post by Baker »

Image

This thing is doing the job "ok". And I don't have to write macros. I just export 2 column Excel worksheet as .csv and import it. And then correct small issues as the Quake engine occasionally has local and global variables with the same name.

(Aside, some of the console and screen drawing variables have the absolutely worst names ... telling you really nothing about what they do. On the plus side: 30 minutes later trying to sort them out and the console code is easy to understand now for me. :D A lot of redundancy, but I'm getting a large chunk of my code under control finally. It'd take a week to manually do what I'm trying to do here, and I'd make typos occasionally or get bored to death.)
The night is young. How else can I annoy the world before sunsrise? 8) Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
behind_you
Posts: 237
Joined: Sat Feb 05, 2011 6:57 am
Location: Tripoli, Libya

Post by behind_you »

ill use it sometime.

Is it freeware?
Baker
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Post by Baker »

behind_you wrote:ill use it sometime.

Is it freeware?
Fully functioning demo as far as I understand it.
The night is young. How else can I annoy the world before sunsrise? 8) Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
dreadlorde
Posts: 268
Joined: Tue Nov 24, 2009 2:20 am
Contact:

Post by dreadlorde »

Try sed.
Ken Thompson wrote:One of my most productive days was throwing away 1000 lines of code.
Get off my lawn!
Spirit
Posts: 1068
Joined: Sat Nov 20, 2004 9:00 pm
Contact:

Post by Spirit »

dreadlorde wrote:Try sed.
I thought about that, but then I thought about to actually do it.

How would you do it? 70 pipes for each file?
Improve Quaddicted, send me a pull request: https://github.com/Quaddicted/quaddicted-data
dreadlorde
Posts: 268
Joined: Tue Nov 24, 2009 2:20 am
Contact:

Post by dreadlorde »

Spirit wrote: I thought about that, but then I thought about to actually do it.

How would you do it? 70 pipes for each file?
sed -f file.sed file(s). file.sed contains multiple lines of search and replace regex commands, which will be iterated through on the file.

The file given to -f doesn't need the suffix .sed, i provided it to be clearer in the answer.
Ken Thompson wrote:One of my most productive days was throwing away 1000 lines of code.
Get off my lawn!
Junrall
Posts: 191
Joined: Mon Sep 21, 2009 12:27 am
Location: North West Oregon, USA
Contact:

Post by Junrall »

This might be a bit late for Baker, but may be of use in the future.

Until 12 midnight you can get a free copy of AKS Text Replacer at Giveaway of the Day

I think this might have been what Baker was looking for?

Anyways, thought I'd share. If you're wanting more info on the program here is the website
Good God! You shot my leg off!
Post Reply