A.J.Mechelynck wrote:
Nikolaos A. Patsopoulos wrote:
Hi,
another two questions:
1. I want to delete all text that has a specific pattern. I use the following code with s command but I want to keep the \a character in the beginning:

:%s/\a,\_.\{-}<\/td><\/tr>/

To delete everything that matches a certain pattern

    :%s/pattern//g

(i.e., replace by nothing). To keep something at the start, see

    :help /\zs
    :help /\@<=


2.
how can I join lines that have non-numerical characters?

e.g.
153
Purdue
Canc Ct
1256

should be
153
Purdue Canc Ct
1256

Thanks in advance,

Nikos



(untested)

    :%g/\D.*\n.*\D/join

i.e. join two successive lines, adding an intervening space, if there is at least one non-digit anywhere in each of them.


Best regards,
Tony.

For 1 I came up with this:

:%s/\(\a\),\_.\{-}<\/td><\/tr>/\1

about 2

:%g/\D.*\n.*\D/join

.* captures some numeric values in between. Maybe sth like this would be better:

:%g/\D.*\n.*[^\d]\D/join

but this is not right.

--
Nikolaos A. Patsopoulos, MD
Department of Hygiene and Epidemiology
University of Ioannina School of Medicine
University Campus
Ioannina 45110
Greece
Tel: (+30) 26510-97804
mobile: +30 6972882016
Fax: (+30) 26510-97867 (care of Nikolaos A. Patsopoulos)
e-mail: [EMAIL PROTECTED]

Reply via email to