Finding something conatined in two lines?

2007-04-12 Thread meino . cramer
Hi,

 Suppose there is a file containing a path/filename -- in each line:

 #
 a.txt
 b.txt
 c.txt
 #
 1.txt
 2.txt
 3.txt
 4.txt
 #
 1.txt
 3.txt
 4.txt
 #

 Now I want to replace any combination of
 1.txt
 2,txt
 by - say - 
 x.txt

 Is there a way to expand / of two/more lines ?

 Keep editing!
 mcc


-- 
Please don't send me any Word- or Powerpoint-Attachments
unless it's absolutely neccessary. - Send simply Text.
See http://www.gnu.org/philosophy/no-word-attachments.html
In a world without fences and walls nobody needs gates and windows.


Re: Finding something conatined in two lines?

2007-04-12 Thread Jürgen Krämer

Hi,

[EMAIL PROTECTED] wrote:
 
  Suppose there is a file containing a path/filename -- in each line:
 
  #
  a.txt
  b.txt
  c.txt
  #
  1.txt
  2.txt
  3.txt
  4.txt
  #
  1.txt
  3.txt
  4.txt
  #
 
  Now I want to replace any combination of
  1.txt
  2,txt
  by - say - 
  x.txt
 
  Is there a way to expand / of two/more lines ?

you can represent an end-of-line inside a regular expression with \n

  :%s/^1\.txt\n2\.txt$/x.txt/

Regards,
Jürgen

-- 
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us. (Calvin)