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

63769Re: quick question

Expand Messages
  • Chris Allen
    Dec 1, 2005
      On 01/12/05, Chris Hudson <chudson@...> wrote:
      > How would I replace every line in a file that starts with certain text, for
      > example every line that begins with 22.

      The 'substitute' command. For example:

      %s/^22.*$/my replacement text/

      That would replace anywhere in the whole file (%) a string which
      started (^) with 22 (22) and then continued on with anything (or even
      nothing) (.*) to the end of the line ($). See also :help :s

      You can also delete any line starting with a certain string using the
      :global command, if you decide you'd rather do that. Something like:

      :g/^22/ d

      HTH,
      Chris Allen
    • Show all 17 messages in this topic