Help: input data to a string/remove the string leaving only the data using batch file

Home Forums Scripting DOS Command Shell Help: input data to a string/remove the string leaving only the data using batch file

Viewing 1 post (of 1 total)
  • Author
    Posts
  • Avatar
    Slow
    Member
    #156222

    Hello, I’m completely new to all of this so forgive my ignorance. I have read through the forums and while I think I found a similar request it wasn’t quite right and my lack of knowledge means I couldn’t tweak the batch file to make it work.

    I hope this makes sense.

    I have a text file (Listing.txt) which lists data and I need to separate the data I need from the other text/data around it.

    For example I have something that looks like this;

    R,T743,DATA1,SOMETHING,SOMETHING_ELSE
    R,T743,DATA2,SOMETHING,SOMETHING_ELSE
    R,T743,DATA3,SOMETHING,SOMETHING_ELSE

    And what I would like is a batch file I can run that will strip away everything I don’t need which would be “R,T743,” and “,SOMETHING, SOMETHING_ELSE” and leave me with;

    DATA1
    DATA2
    DATA3

    And then I need a second batch file that is capable of doing the opposite so using a text file (Numeration.txt) that has;

    DATA1
    DATA2
    DATA3

    Input the data I need in to this string, replacing XXX in each case.

    R,T743,XXX,SOMETHING,SOMETHING_ELSE
    R,T743,XXX,SOMETHING,SOMETHING_ELSE
    R,T743,XXX,SOMETHING,SOMETHING_ELSE

    Both would need to work regardless of how many lines of data I have, it ranges from 1 up to 2000+. We’re using XP Pro if this makes any difference.

    We’re currently able to create this effect using excel to import the text file then create sections and then copy and paste the bits we need back in to a text file and remove any gaps that appear. I believe this to be an archaic way of doing things.

    Any help would be greatly appreciated.

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.