On Fri, 5 May 2006, Vim Visual wrote:

Again thanks a lot... it's working fine, but today I found out that
some blocks are repeated!!

The blocks have to be EXACTLY the same. It seems that your last block
has one less "^<br>$". You may be off by one line.

This script is meant to filter the information of a web page, and it's
run once every 24 hours

Can you have a look at the beginning of my file, Gerald? I think it's
correct and still I am getting the last block of today repeated (in
/tmp/arXiV_2.txt):

--------------------------------------------------------------------------------------------------------------------
:!links -dump http://lanl.arxiv.org/list/astro-ph/new > /tmp/arXiV_1.txt
:e /tmp/arXiV_1.txt
:1,/received/d
:$?^\s*Cross-listings?,$d
:%s/\[abs, ps, pdf, other\] ://g
:%s/\[abs, pdf\] ://g
:%s/Title:/\<b\>T\&iacute;tol\/<i>Title<\/i>:\<\/b\>/g
:%s/Authors:/\<b\>Autors\/<i>Authors<\/i>:\<\/b\>/g
:%s/Comments:/\<b\>Comentaris\/<i>Comments<\/i>:\<\/b\>/g
:let @a=''
:g/hole\|relativistic\c|gravitational\c|waves\c|compact\c|n-body\c|grape\c|coalescence\c|LISA\|black\c|supermassive\c|intermediate\c/?^\s*astro-ph?,/^\s*astro-ph/-y
 A
:%d
:put a
:1d
:%s!^\s*astro-ph/\(\d\+\)!<a href="http://xxx.lanl.gov/pdf/astro-ph/\1";>&</a>
:%s/<a/ <a/g
:%s/^./<br>/
:%s/^$/<br>/
:1s/<br>/<!-- comenca -->/

==
G
:s/<br>/<!-- acaba -->/
==

Instead of the above 2 lines, do this instead

  :$put='<!-- acaba -->'

:g/xxx\.lanl\.gov\|<!-- acaba -->/put!='#end#'
:%s/^\(.*xxx\.lanl\.gov\_.\{-}\_^#end#\)\%(\n\1\)\+$/\1
:g/^#end#$/d
:w! /tmp/arXiV_2.txt
--------------------------------------------------------------------------------------------------------------------


HTH.
--
Gerald

Reply via email to