Mailing List Archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [tlug] Joining lists on the command line



On Fri, Sep 11, 2009 at 04:49:43PM +0900, David Shanahan wrote:
> Is perl considered cheating ?
> 
> ls | perl -e "print join(',', grep { chomp } <>);"

Ah, perl :)

What about this?
	ls | perl -ne 'chomp;print "$c$_";$c=","'

It's not as elegant, but works with abitrarily long input. Just in case 
you wanted to format the output of "yes", say ;)


Leo



Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links