[TriLUG] vi question

Ron Young ronyoung at nc.rr.com
Wed Jul 16 13:49:25 EDT 2008


This works from the command line:
$ cat test
,101.5000,WRAL,,,,,,,,,,,,,,,,,,,,,,Raleigh,,,,,,,,,,,,,,BF,,,,,,,,,,,,,,,,,,,,,,,Rock
$
$ sed '1,$s/,,*/,/g' test
,101.5000,WRAL,Raleigh,BF,Rock
$
$


On Wed, Jul 16, 2008 at 1:25 PM, Greg Brown <gwbrown1 at gmail.com> wrote:

> I'm trying to match multiple commas in a line in vi so I can globally
> change
> them to a single comma (yup, I'm building a .csv file).
>
> Here's an example line::
>
>
> ,101.5000,WRAL,,,,,,,,,,,,,,,,,,,,,,Raleigh,,,,,,,,,,,,,,BF,,,,,,,,,,,,,,,,,,,,,,,Rock
>
> The leading comma is ok, I really don't care about that, it's easy enough
> to
> strip out.
>
> :1,$s/\,+/\,/g  is NOT working.  Grr.  Any hints?  I know I'm overlooking
> something extraordinarily simple here....
>
> Greg
> --
> TriLUG mailing list        : http://www.trilug.org/mailman/listinfo/trilug
> TriLUG FAQ  : http://www.trilug.org/wiki/Frequently_Asked_Questions
>



-- 
Ron Young
919-621-9015



More information about the TriLUG mailing list