Hi Shankar,

1. Get the pattern matching lines in a separate buffer
:g/<pattern>/t$

2. 
:%s/^.*\(<your-pattern>\).*$/\1/


~VIshhu

-----Original Message-----
From: SHANKAR R-R66203 [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, May 31, 2006 4:06 PM
To: 'Vishnu'
Cc: vim@vim.org
Subject: RE: Copying everything (not the complete line, only the
matching pattern) which matches a pattern

This will copy the entire line.
I do not want to copy the entire line, but just the pattern.

Regards,
Shankar



>-----Original Message-----
>From: Vishnu [mailto:[EMAIL PROTECTED]
>Sent: Wednesday, May 31, 2006 3:53 PM
>To: SHANKAR R-R66203
>Cc: vim@vim.org
>Subject: RE: Copying everything which matches a pattern
>
>Hi Shankar,
>
>
>:g/<pattern>/t$
>
>t - copy to address $
>
>
>you can call function instead of t$
>
>~Vishnu
>
>
>-----Original Message-----
>From: SHANKAR R-R66203 [mailto:[EMAIL PROTECTED]
>Sent: Wednesday, May 31, 2006 3:41 PM
>To: 'vim@vim.org'
>Subject: Copying everything which matches a pattern
>
>
>Hi Vimmers,
>
>   I want to copy everything that matches a search pattern.
>
>For example, if my search pattern is
>
>/\$.*s
>
>I want to copy all the patterns that matches this into a buffer.
>
>How can I do this ?
>
>Regards,
>Shankar

Reply via email to