Nikolaos A. Patsopoulos wrote:

Ηι,

I'm want to group a text that has the following text pattern (values and number of lines vary across instances):


<PMID>16893921</PMID>
<Volume>164</Volume>
<Issue>7</Issue>
<Year>2006</Year>

<ISOAbbreviation>Am. J. Epidemiol.</ISOAbbreviation>
<ArticleTitle>Implications of small effect sizes of individual genetic variants on the design and interpretation of genetic association studies of complex diseases.</ArticleTitle>
<MedlinePgn>609-14</MedlinePgn>
<FirstAuthor>Ioannidis JP

Used the following code but got a pattern recognition problem.:

:%s/\(<PMID.*$\)\(<Volume.*$\)\(<Issue.*$\)\(<Year.*\)\(ISO.*$\)\(<ArticleTitle\_.\{-}ArticleTitle>\)\(<MedlinePgn.*$\)\(<FirstAuthor.*$\)/\1\6\5\4\2\3\7\8\g

What am I missing??

%s/\(<PMID.*\)\n\+\(<Volume.*\)\n\+\(<Issue.*\)\n\+\(<Year.*\)\n\+\(<ISO.*\)\n\+\(<ArticleTitle\_.\{-}ArticleTitle>\)\n\+\(<MedlinePgn.*\)\n\+\(<FirstAuthor.*\)$/\1\r\6\r\5\r\4\r\2\r\3\r\7\r\8/

Again, suggested reading:
 :help regexp
:help substitute (and several links therein such as |pattern| and |sub-replace-special|)

Regards,
Chip Campbell

Reply via email to