Results 1 to 3 of 3
how can i copy a certain word from a text file then use this word to replace in another text file??
i tried to use something like:
awk '{print "Hit ...
- 04-12-2011 #1Just Joined!
- Join Date
- Apr 2011
- Posts
- 8
copy &replace text
how can i copy a certain word from a text file then use this word to replace in another text file??
i tried to use something like:
awk '{print "Hit the",$1,"with your",$2}' /aaa/qqqq.txt > uu.txt
but i can't add an argument to point to the second file which i will replace in.
please help me
- 04-13-2011 #2
Can you do something like the following:
If you can provide a bit more of a solid example I may be able to help more.Code:WORD=$(awk '{print $1}' /aaa/qqq.txt); sed -i 's/blah/${WORD}/g' uuu.txt
- 04-13-2011 #3Just Joined!
- Join Date
- Apr 2011
- Posts
- 8
It is the content of each file:
file1.txt:
file2.sh: >>"a script file"55:00 99:00 88:00 11:00 77:00
and the outputfile.sh will be:#!/bin/sh
at 11:11
cp /qq/event.call /var/spool/asterisk/outgoing/
chmod 777 /var/spool/asterisk/outgoing/event.call
at 22:22
cp /qq/event.call /var/spool/asterisk/outgoing/
chmod 777 /var/spool/asterisk/outgoing/event.call
at 33:33
cp /qq/event.call /var/spool/asterisk/outgoing/
chmod 777 /var/spool/asterisk/outgoing/event.call
at 44:44
cp /qq/event.call /var/spool/asterisk/outgoing/
chmod 777 /var/spool/asterisk/outgoing/event.call
at 55:55
cp /qq/event.call /var/spool/asterisk/outgoing/
chmod 777 /var/spool/asterisk/outgoing/event.call
#!/bin/sh
at 55:00
cp /qq/event.call /var/spool/asterisk/outgoing/
chmod 777 /var/spool/asterisk/outgoing/event.call
at 99:00
cp /qq/event.call /var/spool/asterisk/outgoing/
chmod 777 /var/spool/asterisk/outgoing/event.call
at 88:00
cp /qq/event.call /var/spool/asterisk/outgoing/
chmod 777 /var/spool/asterisk/outgoing/event.call
at 11:00
cp /qq/event.call /var/spool/asterisk/outgoing/
chmod 777 /var/spool/asterisk/outgoing/event.call
at 77:00
cp /qq/event.call /var/spool/asterisk/outgoing/
chmod 777 /var/spool/asterisk/outgoing/event.call


Reply With Quote