![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX and Linux Applications Discuss UNIX and Linux software applications. This includes SQL, Databases, Middleware, MOM, SOA, EDA, CEP, BI, BPM and similar topics. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Comma seperator | premar | Shell Programming and Scripting | 6 | 02-17-2006 04:16 AM |
| sed utility to replace /307 with comma | obedkhan | UNIX for Dummies Questions & Answers | 1 | 02-06-2006 11:24 PM |
| Replace , (comma) with space | mbarberis | Shell Programming and Scripting | 6 | 03-29-2005 10:35 AM |
| add comma | alisevA3 | UNIX for Dummies Questions & Answers | 3 | 10-18-2002 09:29 AM |
| Add a comma at end of every line | ST2000 | Shell Programming and Scripting | 4 | 07-14-2002 06:49 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
vi or vim replace ,$ (eol) with just a comma
I have lines in a file like this (140,000+ entries):
value1, value2, value3, " " I want to concatenate the three (there are 22) lines with commas so it looks like this value1, value2, value3 " " I'm trying with :g/,$/s/,$/, /g but that is not flying. any ideas? Thanks, Dan |
|
||||
|
Re: vi or vim replace ,$ (eol) with just a comma
Weeellllll, ok MS Word lets you replace comma + ^013 which takes a comma plus the carriage returns/line feeds/^M and leave just the comma and concatenates any line which had previously a comma (or any other character) and a new line. Sure takes a long time, and much CPU. At least it works.
Would still like to know how to do this in vi or vim, as I remember needing this before. Thanks, Dan |
|
||||
|
I know the Thread is kind of old already, but for who might get this page in a search, here is a other fast alternative:
Code:
:%s/,\n/,/g ![]() |
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|