History Report a problem
Article Edit this page Discussion

Replace all commas with new lines

From Vim Tips Wiki

(Redirected from VimTip877)
Jump to: navigation, search
 

[edit] Obsolete tip

This tip has been merged into another tip.
See VimTip667 for the current tip.

Please do not edit this tip, and do not edit the discussion page.
If anything needs to be improved, please fix VimTip667.


Tip 877Previous TipNext Tip

Created: February 17, 2005 Complexity: intermediate Author: Roumen Semov Minimum version: 6.0 Karma: 9/27 Imported from: Tip#877


Enter one of the following commands to change a comma-separated list of items into a list where each item is on its own line.

" Change CSV items on current line to a list of separate items.
:s/,/\r/g

" Same, for all lines.
:%s/,/\r/g

CSV is comma-separated values (for example, "red,green,blue").

In the replace text of a substitute, \r substitutes a newline.

[edit] Comments

 

Rate this article:

Share this article:

Hubs Highlights International Sites Wikia messages
Entertainment
Gaming
Cartoons & Comics
Science Fiction
Hobbies
Sports
See all...
Grand Theft Auto
Doctor Who
Legend of Zelda Wiki
Terminator Wiki
Everquest II Wiki
Mystery Science Theater 3000
German
Spanish
Chinese
Japanese
More...
Wikia is hiring for several open positions
Send this article to a friend
"Replace all commas with new lines"
 
 
Hi!

I thought you'd like this page from Wikia!

http://vim.wikia.com

Come check it out!
Send confirmation