string - How to replace a text line by searching with '=' symbol in a file using .bat script? -
How can I change the text line by searching the '=' symbol in a file using .bat script?
I have a test file test.txt with text
================================= ============================================= Pat = C: \ Program Files \ Think \ points \ trunk.exe word = c: \ programfile \ microsoft \ word12 \ word.exe
============ =============================================
< P> I am able to change the text "C: \ ProgramFiles \ Think \ Digit \ Trunk.exe" with this word, "deleted" ..........But , I ............ path = c: \ programfile \ variable using SEARTTactic \ Think Ijit \ Trnk.aksa ........ But, I'm unable to search with the '=' operator.
I have a batch file with the following code: -
========================== ================================================== ======
Close @echo setlocal enabledelayedexpansion set INTEXTFILE = C: \ Users \ PrasanthReddy \ Desktop \ test. txt set OUTTEXTFILE = C: \ Users \ PrasanthReddy \ Desktop \ testsimple.txt set SEARCHTEXT = C: \ ProgramFiles \ Think \ digit \ Trunk.exe set REPLACETEXT = Deleted / f "tokens set OUTPUTLINE = = 1, * delims = ¶ "%% A in ('" Searchstr / N ^ ^% INTEXTFILE%' ') (STT String = %% for A / F "Delimise =: Tokens = 1, *" %% a in ("! String!" ) "String = %% b" if "! String!" == "" (echo. & Gt;% OUTTEXTFILE%) Other (SET modified =! String:% SEARCHTEXT% =% REPLACETEXT%! Echo! revised! & gt; & gt;% OUTTEXTFILE%)) Dale% INTEXTFILE% rename% OUTTEXTFILE %% INTEXTFILE%
============ ====== ====================== ===================================
Can anyone help? How can i change it ..... how can i do it ....
instead determine the replacement value of the string, if the replacement and, to echo the basis of results, Adekyueted values
@echo off setlocal enableextensions disabledelayedexpension set "INTEXTFILE = C: \ Users \ PrasanthReddy \ Desktop \ test.txt "set" OUTTEXTFILE = C: \ Users \ PrasanthReddy \ Desktop \ testimple.txt "Set" SEARCHTEXT = C: \ ProgramFiles \ Think \ Digit \ Trunk.exe "Set" REPLACETEXT = DELETED "(if" %% b "==" "(for resonance and set) / f" tokens = 1, * delims =: "%% a in ('findstr / n' ^" "% INTEXTFILE% '')" string = %% b "setlock enabled extension if"! String:% SEARCHTEXT% =! "=="! String! "(Endlocal echo (%% B) Other (Endless Echo (% REPLACETEXT%));"% OUTTEXTFILE% "move / U"% OUTTEXTFILE% ""% INTEXTFILE% "
Comments
Post a Comment