Loading ...
Sorry, an error occurred while loading the content.

53463Re: >> help with scripting vim / search & replace

Expand Messages
  • admin@usachurch.com
    Sep 13, 2004
    • 0 Attachment
      Hello list,

      a while back I learned how to use sed and perl to replace certain patterns
      in a text file thanks to some great suggestions from those on this list.

      Now, I need to do something very similar but I can't figure out how to search
      and/or replace with larger blocks of text with full lines and line breaks.

      for example, take this text file:

      a simple line of text
      and the second line of text is here
      next comes the third line of text
      and finally the fourth line of text

      to search for:

      and the second line of text is here
      next comes the third line of text

      and replace it with:

      and the second line of text is here
      This is some code
      that needs to be inserted
      with line breaks intact
      <blank line>

      to end up with:

      a simple line of text
      and the second line of text is here
      This is some code
      that needs to be inserted
      with line breaks intact

      and finally the fourth line of text


      Is this a job for vim? Or can sed do the job?

      Regards,
      Devin
    • Show all 9 messages in this topic