Question Locked

Writing from one text file to another

0 helpful
5 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Hi
I have to read the contents of a one-liner text file (for example ID=099) to another text file, but within a container (for example VALUE="ID=099"

I'd appreciate any help with this problem.

5 replies

by tony hopkinson

Windows, Linux ?
What is triggering the read ?
This output file is it a one liner as well,
is VALUE="ID=099" all there is?

by zzoran1

Hi
I apologise, I realize now I really should have provided more information.
This is in a Windows environment.
Basically, I have to automate the construction of an SMS mif file.
The basic file has the following layout:
ATTRIBUTE
NAME="blahblah"
ID=1
TYPE=String(250)
VALUE="ID=099"
END ATTRIBUTE

So far, I've just written a command file that parses some file, and creates the output in the one-liner text file, as explained in the first post. I now have to take those results, and create a second file that contains that result, but within the container. It doesn't matter how its done. I can write all the containers one line by one line if need be. The key is getting that data from the first text file into a variable, then getting the variable into the second text file, but obviously within the container. I hope this clears it up a bit :)

by tony hopkinson

@ECHO OFF
ECHO ATTRIBUTE
ECHO NAME="blahblah"
ECHO ID=1
ECHO TYPE=String(250)
ECHO VALUE="%~1"
ECHO END ATTRIBUTE

Stick this lot in a cmd file called makemif.cmd
then makemif "ID=99" > newmif.mif

Should give you a start.

by zzoran1

Yep, this is definitely helpful. Thanks very much for the reply :)

This discussion is closed to new replies.