Computing.Net > Forums > Disk Operating System > Batch file replacing text

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Batch file replacing text

Reply to Message Icon

Name: Kai74
Date: December 9, 2003 at 06:59:39 Pacific
OS: xp
CPU/Ram: 2600/1024
Comment:


I have a ini file looking like this(autodist.ini)

Copy1=\\jj4300\Update\*.lzh=>c:\TilButik\jj1234
Copy2=\\jj4300\Update\*.bat=>c:\TilButik
Copy3=\\jj4300\Update\*.200=>c:\TilButik
Copy4=\\jj4300\Update\*.100=>c:\TilButik

In that file I would like to replace some of the lines with lines found in an other file (replace.ini) looking like this.

Copy1=\\jj4300Update\Denmark\*.lzh=>c:\TilButik\jj1111
Copy2=\\jj4300\Update\Norway\*.bat=>c:\TilButik
Copy3=\\jj4300\Update\Denmark\*.200=>c:\TilButik
Copy4=\\jj4300\Update\Norway\*.100=>c:\TilButik

The only thing unique for bout files is the first 8 letters.

The hole thing should run in a Batch file. So if somebody now about a tool that can fix this please help me.

Best regards Kai74



Sponsored Link
Ads by Google

Response Number 1
Name: sajjadr21
Date: December 9, 2003 at 08:18:53 Pacific
Reply:

hi there

following will resolve your issue.
it replace "&" with "&" in dirlist.xml and will write the results to dirlist1.xml

please make sure that input file and output file should be different

hope it helps
/sajjad

@echo off
:: Create the assembler program, by Herbert Kleebauer
echo Bj@jzh`0X-`/PPPPPPa(DE(DM(DO(Dh(Ls(Lu(LX(LeZRR]EEEUYRX2Dx=> %temp%.\sbs2.com
echo 0DxFP,0Xx.t0P,=XtGsB4o@$?PIyU!WvX0GwUY Wv;ovBX2Gv0ExGIuht6>> %temp%.\sbs2.com
echo ?@}IKuNWpe~Fpe?FNHlF?wGMECIQqo{Ox{T?kPv@jeoSeIlRFD@{AyEKj@>> %temp%.\sbs2.com
echo iqe~1NeAyR?mHAG~BGRgB{~H?o~TsdgCYqe?HR~upkpBG?~slJBCyA?@xA>> %temp%.\sbs2.com
echo LZp{xq`Cs?H[C_vHDyB?Hos@QslFA@wQ~~x}viH}`LYNBGyA?@xAB?sUq`>> %temp%.\sbs2.com
echo LRy@PwtCYQEuFK@A~BxPtDss@fFqjVmzD@qBEOEenU?`eHHeBCMs?FExep>> %temp%.\sbs2.com
echo LHsPBGyA?@xAunjzA}EKNs@CA?wQpQpKLBHv?s`WJ`LRCYyIWMJaejCksl>> %temp%.\sbs2.com
echo H[GyFGhHBwHZjjHeoFasuFUJeHeB?OsQH[xeHCPvqFj@oq@eNc?~}Nu??O>> %temp%.\sbs2.com
echo ~oEwoAjBKs?Zp`LBzHQzyEFrAWAG{EFrAqAGYwHTECIQ{coKIsaCsf{Oe~>> %temp%.\sbs2.com
echo CK}Ayre~CNFA{rAyEKFACrA{EKGAjbA}eKGSjNMtQFtc{OAyDGFj?{FDGQ>> %temp%.\sbs2.com
echo KAjNVk_OCAx@e?f{o?CosI}1EGizhljJ~H1ZeG}JBA~rACBMDGjjDG@g0>> %temp%.\sbs2.com

:: Use the program
%temp%.\sbs2.com 0 "&" "&" < c:\dirlist.xml > c:\dirlist1.xml


:: Delete the program
del %temp%.\sbs2.com


0

Response Number 2
Name: Kai74
Date: December 10, 2003 at 23:53:27 Pacific
Reply:

HI sajjadr21
Hm. I'm not sure about what you mean!! Is it possibel to explain this a bit clearer..

Best Regards Kai74


0

Response Number 3
Name: dtech10
Date: December 11, 2003 at 14:37:51 Pacific
Reply:

Hi Kai74

Hi
would something along these lines help, or
do the lines have to be in the same place as the replaced lines.

Find lines thaton'thave "jj4300re\Update" and write to NewFile.ini
/v lines that don't contain the text
/i ignore case, might not be needed
\Update" >newfile.ini
rem find files in second file and append to file rem NewFile.ini

--------------------
@echo off
type autodist.ini | find /v /i "jj4300
type replace.ini | find "jj4300\Update" >> newfile.ini
--------------------


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Disk Operating System Forum Home


Sponsored links

Ads by Google


Results for: Batch file replacing text

Batch file - replacing files by date www.computing.net/answers/dos/batch-file-replacing-files-by-date/7023.html

Batch File Installer Program www.computing.net/answers/dos/batch-file-installer-program/10810.html

batch file to get subset of dir? www.computing.net/answers/dos/batch-file-to-get-subset-of-dir/15350.html