Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Batch File to search a word and replace with another in same line  (Read 3878 times)

0 Members and 1 Guest are viewing this topic.

chandru630

  • Guest
Hi All,

     I am looking for a batch file to search a word start with abc_ and replace with the whole word with another word in same line.


For Ex:

#define PNG  file type  icon abc_029_x200_y200 s_pnot0w12h8
#define PNG  file type  icon msn_549_x547_y540 s_pnot1w12h8
#define PNG  file type  icon ijk_469_x497_y569 s_pnot2w12h8
#define PNG  file type  icon rst_712_x492_y478 s_pnot3w12h8


Out put to be:

#define PNG  file 029 icon abc_029_x200_y200 s_pnot0w12h8
#define PNG  file 549  icon msn_549_x547_y540 s_pnot1w12h8
#define PNG  file 469  icon ijk_469_x497_y569 s_pnot2w12h8
#define PNG  file 712  icon rst_712_x492_y478 s_pnot3w12h8

In the output, word "type" is replaced with value "abc_029_x200_y200" and removes the character other than 029.


like this i have 100's of textfile with 100s of line. Pls help me to do this task using batch file.

Squashman



    Specialist
  • Thanked: 134
  • Experience: Experienced
  • OS: Other
Re: Batch File to search a word and replace with another in same line
« Reply #1 on: January 25, 2014, 10:59:16 PM »
Very similar to your previous request. You should be able to take the examples you were already given and tweak them for this example.

foxidrive



    Specialist
  • Thanked: 268
  • Experience: Experienced
  • OS: Windows 8
Re: Batch File to search a word and replace with another in same line
« Reply #2 on: January 26, 2014, 03:05:22 AM »
     I am looking for a batch file

Is there a reason why you didn't follow up your previous thread? 

It's polite to say "yes it worked" or "It didn't work because it did [this] instead"