write a batch file to get a directory of text files/ search for a specific token and insert a line after that -


I need to read a bunch of text files from a folder. For each text file, a specific token like "Corolla" Find and insert a new line after the token. Suppose that the text file is the same:

 the first line second row the third line, the corolla, the third line the remaining INSERT the new line the rest of the file here 

I am very new in batch files And this is challenging for me.

Partial Answer:

I can use the following code, but this code only gets token if the whole line has a token. I need to find a token if it is even between some sentences (substrings)!

  @echo off set SrcFolder = C: \ input set for DstFolder = C: \% in output% ("% SrCFolder% \ * .txt") ((/ for / f "Usebackq delims =" in %% h ("%% a") (resonance. %% h if "%% h" equ "corolla" (echo new line)) "% dstFolder% \ %% ~ nxa")  

  place of "%%" On the "Corolla" ( 

(which should generate an error anyway)

put

  resonance %% h | search "Corolla"> Null & If not otherwise error level 1 ( 

The literal "corolla" in each row Set to install error level to 0 . if error level 0 because findstr always If there is a positive integer error and error level test for error level n or greater than n , then P>


Comments

Popular posts from this blog

ios - How do I use CFArrayRef in Swift? -

eclipse plugin - Run java code error: Workspace is closed -

c - Error on building source code in VC 6 -