On Thu, 4 May 2006, Tim Chase wrote:
Which command should I add in the script to tell vi to embed it in the
correct place?
At the moment I do it by telling vi something like "go to line XXX,
delete everything, insert text":
:386,$d
o <CTRL + v + ESC>
:r /tmp/arXiV_2.txt
:w! ~pau/WWW/arXiV.html
But the inconvinient is that I have to modify the vim script whenever
I add something to the web page, the number line 386 is wrong... and
it is very tedious
Well, rather than a fixed line number, you can have some unique token in your
file. E.g., you can have a unique comment to mark the start of the
content...something like
<!-- CONTENT GOES HERE -->
Then, instead of ":386,$d", you can do
:/CONTENT GOES HERE/+,$d
That finds the line containing that text ("/CONTENT GOES HERE/"), and then
deletes ("d") from the following line ("+") to the end of the file ("$").
[snip]
Yes, Tim has explained everything. In the OP's case, "CONTENT GOES HERE"
is "<!-- Fixter viu comenca -->". The OP can also shorten :d and :r to
:/<!-- Fixter viu comenca -->/+,$!cat /tmp/arXiV_2.txt
or for a Windows system
:/<!-- Fixter viu comenca -->/+,$!type /tmp/arXiV_2.txt
--
Gerald