[PLUG] how to create a comma-delimited list?

Colin Kuskie ckuskie at dalsemi.com
Mon Jul 15 20:31:21 UTC 2002


On Mon, Jul 15, 2002 at 11:44:04AM -0700, Matt Alexander wrote:
> I have a list of items like this:
> 
> bob
> sam
> joe
> mark
> sally
> marge
> 
> And I'd like to convert it to this:
> 
> bob,sam,joe,mark,sally,marge
> 
> Is there a way to do this within vi?

:1,$!perl -0777pe 'tr/\n/,/;'

Always use the right tool for the right job.

Colin




More information about the PLUG mailing list