LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Blogs
User Name
Password

Notices

Old

How to replace letters with carriage returns on VIM

Posted 10-27-2010 at 01:35 PM by xri
Updated 10-27-2010 at 01:38 PM by xri (To add categories)

Problem:
A text file coms with a list comes with the items separated by commas, like:
Quote:
a,b,c....
We need them in column form, like:
Quote:
a
b
c
Solution:
:%s/,/{[Ctrl+v], then [Enter]}/g

Notes:
  1. The % before s, indicates that the range where the replacement is to take place is the whole document.
  2. Ctrl and v are pressed simultaneously, and then the character we mean vim to use (in this case Return).
  3. The g at the end of the
...
xri
Member
Posted in Software
Views 1016 Comments 0 xri is offline

  



All times are GMT -5. The time now is 07:38 AM.

Main Menu
Advertisement

My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration