|
Answer» Hello, I am new to batch scripting. I need a complete batch script to find (set of given values) and REPLACE them with new values in all the files in the folder and sub folder. PLEASE help .
The files might not be .txt always.
Sample file content:
./adt_btth/cfg/wf_btth.cfg:$BadFile_1=/atadata/ipm/adt_btth/badfiles/VSYM_PROD.bad ./adt_btth/cfg/wf_btth.cfg:$PMSessionLogFile=/export/home/ipm/adt_btth/logs/sessions/s_concate_usoc.log
(STRING in bold above needs to be replaced with new path.
New Value will look like:
./adt_btth/cfg/wf_btth.cfg:$BadFile_1=/Info_new/Info/NDW/badfiles/VSYM_PROD.bad ./adt_btth/cfg/wf_btth.cfg:$PMSessionLogFile=/home/logs/info/NDW/logs/sessions/s_concate_usoc.log
There will be many such lines in one file and then many files in a folder and subfolders.
Please help. Please let me know if i should give more information here. You said please help. When I have had to replace text in a set of files. I use a tool that does well with string manipulation. Yes, you could do it it batch, but fif batch is hard for you, pick another tool. Consider this outline. ---- For every file, DO this --- replace every INSTANCE of A$ in the file with B$ until done. ---- where A$ represent s group of letters in the file and B$ is the replacement value.
Batch files are good for making jobs for other programs. Such as making a list of files. However, if you really want it all in batch, just wait here. An expert will show up soon.
JFTR The QUESTION is multi-posted
http://www.dostips.com/forum/viewtopic.php?f=3&t=5308Thanks for your reply but i need to use a batch script (.bat) and not any tool.
|