Hy fellow programmers,
I started my game with german as the language.
But now I want to change everthing to english to be more international.
So I need to change all the variables in all my files.
Does anybody know a method to acomplish this without having to edit all files per hand?
Change string in muliple files
You could use a "sed" command to accomplish this:
This would replace all "GermanVar" with "EnglishVar" in filename.pb and then save as "filename.eng.pb"
Code: Select all
sed "s/GermanVar/EnglishVar/g" filename.pb > filename.eng.pbThanks a lot for the hint. That helped a lot already.
But now I got the problem that he does not want to change some special characters.
The documentation to sed is quite huge. I can't figure it out how it works to change this string:
skills(2,
Into this string:
skills(#COMBAT_TRAINING,
I get something like:
bash: syntax error near unexpected token `('
Can somebody here can give me a quick hint for that ?
But now I got the problem that he does not want to change some special characters.
The documentation to sed is quite huge. I can't figure it out how it works to change this string:
skills(2,
Into this string:
skills(#COMBAT_TRAINING,
I get something like:
bash: syntax error near unexpected token `('
Can somebody here can give me a quick hint for that ?
Try escaping the "(" like so:
Code: Select all
sed "s/skills[\(]2/skills(#COMBAT_TRAINING/g" file.txt >newfile.txtOkay, I wrote a long scripts which contains all the filenames I want to change.
Now I got one more problem
I can't change one file to its own name, then the target file is empty. So I copy all of them to new filenames. Means laby.pb to laby.pb2.
Now I want to change all files ending in .pb2 back to .pb.
Is there another nice command that I do not know which can handle that ?
Now I got one more problem
I can't change one file to its own name, then the target file is empty. So I copy all of them to new filenames. Means laby.pb to laby.pb2.
Now I want to change all files ending in .pb2 back to .pb.
Is there another nice command that I do not know which can handle that ?
Yes there is, however if it is used incorrectly, it is far from nice!
Just be sure you have a backup first.
Code: Select all
mv laby.pb2 laby.pbCode: Select all
tar cvf pbfiles.backup.tar *.pb2