Looking for a computer program that can find and edit text in multiple files

Aaron

<Bronze Donator>
4,430
5,464
31d 6h 40m
So, I was going to mod a game, but found out that in order to do what I want to do I'll have to edit a few lines of text in a number of .txt files located in a single folder. We're talking about hundreds of files here so manually doing this would be pretty tedious. I'd like to know if anyone here can recommend a program that can do this. Basically it needs to have an input string where you can enter a value, and if the file has that value it changes it to something else. Any advice?
 

Noodleface

A Mod Real Quick
37,569
14,155
60d 1h 29m
Can you program? This sounds like something that can be done relatively easily through Python
 

Aaron

<Bronze Donator>
4,430
5,464
31d 6h 40m
I can't program yet, but I was thinking that this is probably something that is fucking easy to do if you can. I have been dabbling at Codecadamy so maybe I should keep that up until I can figure it out myself.

As for Notepad++, I have that, but didn't know it could do it. I'll have to read up on how. Thanks!
 

Aaron

<Bronze Donator>
4,430
5,464
31d 6h 40m
@Dick: No, after taking a look then in the ctrl+f Find window there is a tab for searching and replacing text in documents. I gave it a test and it works wonders.

@Melvin: While I do have Mint on my laptop I'm still a complete linux noob so I'm not quite sure what that means. :S
 

Melvin

Trakanon Raider
1,383
1,121
17d 10h 2m
That's a conditional operator, not exactly a Linux thing, more of a programming thing. Using (a ? b : c) as an example: if a is true use b, else use c.

Sounds like you have the problem sorted out already, but I'll plugsedanyway. This is the kind of job that sed was born to do.
 

ShakyJake

Bronze Baronet of the Realm
4,452
10,265
70d 6h 1m
Yeah this would be trivial in C# or VB. In fact I could probably write you something in a few minutes. Is this on a Windows PC?
 

Aaron

<Bronze Donator>
4,430
5,464
31d 6h 40m
Yeah, it's a windows PC, but Notepad++ has it pretty much sorted. Come April when I have some more spare time I'm going to get back to Codecadamy and learn Python as I think making a program that can do this would be a good "hello world" program. At least, it would do something useful and it would be easy to see if I've fucked up lol
 

Deathwing

<Bronze Donator>
13,074
4,187
103d 8h 11m
That's a conditional operator, not exactly a Linux thing, more of a programming thing. Using (a ? b : c) as an example: if a is true use b, else use c.

Sounds like you have the problem sorted out already, but I'll plugsedanyway. This is the kind of job that sed was born to do.
Just curious, why use sed unless you absolutely must stay in the shell?
 

Melvin

Trakanon Raider
1,383
1,121
17d 10h 2m
Dude's talking about writing a program, sed would do this in one line.
 

Deathwing

<Bronze Donator>
13,074
4,187
103d 8h 11m
Fair enough, I think I was falling into the trap of over complicating it or doing what's comfortable. To me, the solution to his question is a perl or python script. My history with sed is seeing it stuffed in ancient unix scripts when I used to work at IBM. So even though I'll gladly use things like grep and find, because scripting languages have absorbed regex, I tend to think, perhaps incorrectly, sed as an outdated relic.
 

ShakyJake

Bronze Baronet of the Realm
4,452
10,265
70d 6h 1m
If aaron wants to learn how to program then it's best to find a simple project to work on. Just reading a book or following a tutorial isn't quite the same.
 

Aaron

<Bronze Donator>
4,430
5,464
31d 6h 40m
That's what I was thinking too. I was originally thinking of writing a conversion program since I need to do a lot of conversions (metric to imperial, etc.) but when I brought it up with my friend who's been working as a programmer since the 90s he said, why not just use google? Well... I do, but it sort of kills the point of having a nice easy project as a first goal. Something you could prolly do in an afternoon, or over the weekend and the output is simple enough to see if you've fucked up. It's not as if you're going to program a WoW killing MMO for your first shot lol.
 

Noodleface

A Mod Real Quick
37,569
14,155
60d 1h 29m
To me this is a perfect learning small project for Python. Could do it with sed, but if the dude wants to program this is a simple enough script to start with.
 

Melvin

Trakanon Raider
1,383
1,121
17d 10h 2m
This is probably funnier to me than anyone else, but... The last time I saw a thread like this, someone else solved the problem with sed (and maybe some awk too?) and I said that I probably would've done it in python. >_<
 

mixtilplix

Lord Nagafen Raider
1,295
109
You can also easily do this with Sublime text (right click folder in the side bar panel and then search ) which is a roundabout way of doing it via python heh.