Forum

Mass Search and Replace?

Discuss programming topics for the various GPL'd game engine sources.

Moderator: InsideQC Admins

Mass Search and Replace?

Postby Baker » Tue Mar 01, 2011 4:03 pm

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 ..
User avatar
Baker
 
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Postby behind_you » Tue Mar 01, 2011 4:16 pm

notepad ++ has find and replace in files function. Very time saving, and it has many options such as filters and which directory to search.
User avatar
behind_you
 
Posts: 237
Joined: Sat Feb 05, 2011 6:57 am
Location: Tripoli, Libya

Postby Baker » Tue Mar 01, 2011 4:23 pm

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 ..
User avatar
Baker
 
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Postby Baker » Tue Mar 01, 2011 4:34 pm

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 ..
User avatar
Baker
 
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Postby behind_you » Tue Mar 01, 2011 4:38 pm

www.replsoft.com/replacer.html

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

Postby behind_you » Tue Mar 01, 2011 4:42 pm

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...
User avatar
behind_you
 
Posts: 237
Joined: Sat Feb 05, 2011 6:57 am
Location: Tripoli, Libya

Postby Baker » Tue Mar 01, 2011 5:57 pm

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 ..
User avatar
Baker
 
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Postby Spirit » Tue Mar 01, 2011 6:26 pm

You could write a macro for JEdit.
Improve Quaddicted, send me a pull request: https://github.com/SpiritQuaddicted/Quaddicted-reviews
Spirit
 
Posts: 1031
Joined: Sat Nov 20, 2004 9:00 pm

Postby Baker » Tue Mar 01, 2011 6:37 pm

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 ..
User avatar
Baker
 
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Postby behind_you » Tue Mar 01, 2011 8:49 pm

ill use it sometime.

Is it freeware?
User avatar
behind_you
 
Posts: 237
Joined: Sat Feb 05, 2011 6:57 am
Location: Tripoli, Libya

Postby Baker » Tue Mar 01, 2011 9:00 pm

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 ..
User avatar
Baker
 
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Postby dreadlorde » Wed Mar 02, 2011 4:47 am

Try sed.
Ken Thompson wrote:One of my most productive days was throwing away 1000 lines of code.

Get off my lawn!
User avatar
dreadlorde
 
Posts: 268
Joined: Tue Nov 24, 2009 2:20 am

Postby Spirit » Wed Mar 02, 2011 3:32 pm

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/SpiritQuaddicted/Quaddicted-reviews
Spirit
 
Posts: 1031
Joined: Sat Nov 20, 2004 9:00 pm

Postby dreadlorde » Wed Mar 02, 2011 8:45 pm

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!
User avatar
dreadlorde
 
Posts: 268
Joined: Tue Nov 24, 2009 2:20 am

Postby Junrall » Sun Mar 06, 2011 8:45 am

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!
User avatar
Junrall
 
Posts: 191
Joined: Mon Sep 21, 2009 12:27 am
Location: North West Oregon, USA

Next

Return to Engine Programming

Who is online

Users browsing this forum: No registered users and 1 guest