Mailing List Archive
tlug.jp Mailing List tlug archive tlug Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]Re: [tlug] Joining lists on the command line
- Date: Fri, 11 Sep 2009 15:26:47 +0900
- From: BALUTA Chris <baluta@example.com>
- Subject: Re: [tlug] Joining lists on the command line
- References: <20090911055611.GB5688@example.com>
- User-agent: Mutt/1.5.18 (2008-05-17)
Leo Howell wrote: > What's the most unixy way to put them into a comma-separated list using > the command line? Well, I think almost by definition there isn't a 'most unixy' way to do much of anything, which is one of the fun things about the unix command line. But, how about this: echo `<your command>` | sed -e 's/ /,/g' For example, say ls gives this: myprompt> ls afile bfile cfile dfile theLastFile myprompt> echo `ls` | sed -e 's/ /,/g' gives: afile,bfile,cfile,dfile,theLastFile myprompt> echo `seq 1 20` | sed -e 's/ /,/g' leads to: 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20 Of course, you'll have problems w/spaces if your command output for one line has spaces in it (e.g. output from grep)... -Chris
- Follow-Ups:
- Re: [tlug] Joining lists on the command line
- From: Ian Barwick
- References:
- [tlug] Joining lists on the command line
- From: Leo Howell
Home | Main Index | Thread Index
- Prev by Date: Re: [tlug] Joining lists on the command line
- Next by Date: [tlug] News from Tux
- Previous by thread: Re: [tlug] Joining lists on the command line
- Next by thread: Re: [tlug] Joining lists on the command line
- Index(es):
Home Page Mailing List Linux and Japan TLUG Members Links