Sep 262009

Every person associated with the unix / linux would be familiar with the text editor called vi / vim. but not many people know that vi / vim can be used as a stream editor. This is one example of how to use vi / vim as a text editor. suppose we have a text file containing the following text:



we will change the “hahaha” becomes “gagaga”

here’s what we do using vim

$ vim -b -c ":%s/hahaha/gagaga/g|:wq" sample.txt
"sample.txt" 6L, 24C
"sample.txt" 6L, 24C written

Now let’s see change that we’ve made

$ more sample.txt

cool isn’t it? 🙂

  2 Responses to “Using VIM as stream editor”

Comments (2)
  1. nice info

  2. Great! So excited to know about this.

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>




This site uses Akismet to reduce spam. Learn how your comment data is processed.