![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
sed
i have files: username.txt and passwword.txt and sourcefile.txt
username.txt contains tjmannonline password.txt contains abc123 username=`tail username.txt' passwd=`tail password.txt' my sourcefile.txt contains: <RDID><![CDATA[USERNAME]]></RDID> <user><![CDATA[USERNAME]]></user> <password><![CDATA[PASSWORD]]></password> sed -e 's/USERNAME/$username/g' sourcefile.txt > sourcefile.txt1 sed -e 's/PASSWORD/$passwd/g' sourcefile.txt1 > sourcefile.txt2 all said and done, i'd like to have this result: <RDID><![CDATA[tjmannonline]]></RDID> <user><![CDATA[tjmannonline]]></user> <password><![CDATA[abc123]]></password> sed -e 's/USERNAME/$username/g' did not replace USERNAME with tjmannonline, it replaced it with $username. |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
never mind. i searched via unix.com, and sed -e 's/USERNAME/'${username}'/g took care my question. once again, thanks to unix.com
|
|
#3
|
|||
|
|||
|
Great !
Thats what I keep saying, please do search the forum before posting. Now the search code would be happy ! |
|||
| Google The UNIX and Linux Forums |