Search code examples
textrenamebatch-rename

Changing batch text format


i have around 900 lines of text in this format: AddTextEntry("TextHere", "TextHere") .. i want to rename these to this format: {model = "TextHere", vehicleName = "TextHere"}, while keeping all of the original text in place which is in this example TextHere.

is this possible? since doing them one by one for 900-1000 lines is a time consuming job. Thanks.


Solution

  • Make a copy of the original file.

    Open the original file in Notepad. You can use Sublime Text or another text editor also.

    Do find..replace in Notepad by clicking Edit > Replace.

    • In Find what, type this: AddTextEntry("
    • In Replace with, type this: {model = "
    • Click Replace All

    That way, you replace AddTextEntry with model.

    Go to the top of the file. Do find..replace again.

    • In Find what, type this: ", "
    • In Replace with, type this: vehicleName = "
    • Click Replace All

    That way you add vehicleName before the 2nd text.

    Go to the top of the file. Do find..replace again.

    • In Find what, type this: ")
    • In Replace with, "}
    • Click Replace All

    That way, you change the last close parenthesis with close curly brace.

    Review the file. If all looks good, Save the file.