Batch Scripting – how to read a string value from a text file

Home Forums Scripting General Scripting Batch Scripting – how to read a string value from a text file

Viewing 1 post (of 1 total)
  • Author
  • #143486

    I am trying to create a batch file that steps through a file until it finds a particular line. When it finds the line, it writes a few key words from that line into a new file.

    To make things less abstract let me give an example of what I am trying to do:

    I have a file that I need to look through to extract all values after the Name tag, and put it in a different file if it does not already exist in that file. The lines within the file I am searching through look like this:

    So I need to look for lines that contain the following text:

    then only extract the value after the ‘Name =’ tag

    so in this case I need /contextroot1/*, /contextroot2/* and /contextroot3/*.jsp. Then I need to put these values in a file TestFile.txt if that file does not already contain these values.

    So for now i am able to just get all the lines containing the text:

    but not sure how can I extract the value after Name=
    and store it in the file TestFile.txt

    I know that this could be easily done using Perl or VBScript, but I do need to use a batch file to get this done.

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.