![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | 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 !! |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
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. |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|