Reputation: 1
I want to append a string variable. for e.g. WINDOW=WINDOW winName="fp_w_RetrocessionTrigger" winTitle="Retrocession Trigger" comp="FPGUI" funcId="14316" domainId="bancs" preLoad="true"> This is my string variable(WINDOW). I want this varible of string get append in another file using sed or awk cmd.
Although I have tried the cmd like sed -i ''$n'i "'$WINDOW'"' test.xml but it only prints space there. Please help me.
Upvotes: 0
Views: 45
Reputation: 527
Your question is not very clear, however if u want to append a text in the beginning and/or at the end of each line of a file, you can try the below
$ cat 1.txt
1
2
3
4
5
Add the text in the beginning of the line :
$ sed -e 's/^/start_of_the_line/' -i 1.txt
Add the text at the end of the line :
$ sed -e 's/$/end_of_the_line/' -i 1.txt
Output
$cat 1.txt
start_of_the_line1end_of_the_line
start_of_the_line2end_of_the_line
start_of_the_line3end_of_the_line
start_of_the_line4end_of_the_line
start_of_the_line5end_of_the_line
Upvotes: 1