• Home
  • About
  • Archives
Skip to content

Pario TechnoBlob

A chronological documentation test project, nothing serious, really!

  • Home
  • About
  • Archives

vim search and replace text

Posted on 7. May 200730. November 2007 by Hans-Henry Jakobsen

Different ways of replacing text etc.

Replace every occurrence of pattern1 (pat1) with pat2

:g/pat1/s//pat2/g

Replace every occurence of pattern1 (pat1) with a newline

:g/pat1/s//\r/g

In practice this inserts a newline after every occurence of pat1.

Share this:

  • Twitter
  • Facebook
Posted in: Linux, ScriptingTagged: replace, vim

Post navigation

Previous: Skrive til syslog
Next: Find all web pages that reference to www.example.com
Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
To find out more, including how to control cookies, see here: Cookie Policy

Search

Apache apt-get awk backup basename bash CentOS convert csv Database dd Debian esxi5 Etch EXIF Fedora find Gentoo grep howto html imagemagick iptables iso jhead JPG mount MySQL Nikon nmap perl PHP Postfix RedHat rename rhel5 sed sftp SMTP sort ssh Ubuntu VMware Wordpress Zimbra

  • Backup
  • Linux
  • Misc
  • Network
  • Photo etc
  • Scripting
  • Security
  • Virtualization
  • Web
  • Windows
Resume X WordPress Theme by Wp Theme Space