search in txt file and write

Microsoft Windows xp home edition sp2b
January 7, 2010 at 04:29:46
Specs: Windows XP

Dear All,

I need you to create a batch file that will search in txt file this txt file have values like this

# Forms applet parameter: URL path to Forms ListenerServlet
serverURL=/forms/lservlet
# Forms applet parameter
codebase=/forms/java
# Forms applet parameter
imageBase=codebase
# Forms applet parameter
width=300%
# Forms applet parameter
height=300%
# Forms applet parameter
separateFrame=false
# Forms applet parameter
splashScreen=
# Forms applet parameter

now i need a help to access this file and search for this value (imageBase) and then change it for something like this (xxxxxx)

imageBase=xxxxxx

plz help and advice


See More: search in txt file and write

Report •

#1
January 7, 2010 at 07:52:08
@echo off > newfile & setLocal enableDELAYedeXpansion

for /f "tokens=* delims= " %%a in (myfile) do (
set S=%%a
  if !S:~0^,9! equ imageBase (
    >> newfile echo.imageBase=xxxxxx
    ) else (
    >> newfile echo.!S!
  )
)


=====================================
Helping others achieve escape felicity

M2


Report •

#2
January 8, 2010 at 21:18:47
heloo Mechanix2Go,

first thank you very much for reply

I forgot to told you where is this file exist and what is the file

name

path: D:\DevSuiteHome_1\forms\server\formsweb.cfg

file name : formsweb.cfg

plz i need help again
and thanks again for your reply


Report •

#3
January 10, 2010 at 22:07:56
hi friends, i realy need littel more help here

Report •

Related Solutions

#4
January 10, 2010 at 23:36:49
Hopefully, with a little effort, you can tailor the script to your path & filename.


=====================================
Helping others achieve escape felicity

M2


Report •

#5
January 10, 2010 at 23:45:57
plz Mechanix2Go provide me by example of my question

Report •

#6
January 12, 2010 at 22:54:52
You're not trying very hard.

Where I have: myfile you put:

D:\DevSuiteHome_1\forms\server\formsweb.cfg


=====================================
Helping others achieve escape felicity

M2


Report •

#7
January 12, 2010 at 23:28:44
this what i did Mechanix2Go i change myfile to :

D:\DevSuiteHome_1\forms\server\formsweb.cfg

@echo off > newfile & setLocal enableDELAYedeXpansion

for /f "tokens=* delims= " %%a in (D:\DevSuiteHome_1\forms\server\formsweb.cfg) do (
set S=%%a
if !S:~0^,9! equ imageBase (
>> newfile echo.imageBase=codebase
) else (
>> newfile echo.!S!
)
)


no news, plz could you help me more


Report •

#8
January 12, 2010 at 23:48:32
What did you get in newfile?


=====================================
Helping others achieve escape felicity

M2


Report •

#9
January 13, 2010 at 01:36:31
i get nothing, it's empty file

plz Mechanix2Go i don't need to create a new file i just need to
to change some lines in this file D:\DevSuiteHome_1\forms\server\formsweb.cfg

so plz help to change this line and if i have another lines in this
file where i can put it in your code

plz more help & andvice


Report •

#10
January 13, 2010 at 02:57:42
[1] I see nothing wrong with your script.

[2] Yes, you **DO** need a new file. A batch can NOT read and write a file at the same time.

[3] Are you getting any error?


=====================================
Helping others achieve escape felicity

M2


Report •

#11
January 13, 2010 at 05:14:05
Hi Mechanix2Go

i don't no how the error should be look like, but i will tell you what i can see, after i create your script in this folder :
D:\DevSuiteHome_1\forms\server
and double click the batch file i see a black blank dos window
this window stay open for while and then disapear.
After that i double click my file formsweb.cfg and no news

so plz plz more help


Report •

#12
January 13, 2010 at 05:20:32
Forget clicking.

Run it from the prompt.


=====================================
Helping others achieve escape felicity

M2


Report •

#13
January 16, 2010 at 01:32:45
i did it Mechanix2Go but there is nothing happen in file

Report •

Ask Question