Will UID and PWD always be on the same line in File1 ?
Do you really want the spaces between the quotes in the updated File1 ?
Can UID or PWD appear more than once in File1 ?
Its not what you are thinking. Am just trying it with shell. I just want to know whether it is possible in shell or not.
My approach is that i will store the UID and PWD as variables in file2. I will write a script file3.sh
file3.sh:
. file2
sed /replace the pattern from file1 with values in file 2. //use sed here.. I donno using sed command
<UID = "admin" PWD = "password">
In the 1st post in this thread you said File2 (note the uppercase F ) contains the code:
UID ="admin"
PWD ="password"
You haven't told us what OS or shell you're using, but there are at least two problems here:
A file named File2 can't be loaded using the command . file2 . (On UNIX and Linux systems, file names are case sensitive.)
The commands in File2 are not assignment statements. They invoke the utility named UID with the operand -admin and the utility named PWD with the operand =password .
If you set the contents of file2 to be valid shell variable assignments as clx suggested:
UID="admin"
PWD="password"
(Note that there are no spaces around the = in either of these commands), then the following commands in file3 should do what you want: