Mailing List Archive


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

Re: [tlug] Joining lists on the command line



2009/9/11 David Shanahan <david@example.com>:
> On Fri, Sep 11, 2009 at 2:56 PM, Leo Howell <leo@example.com> wrote:
>>
>> What's the most unixy way to put them into a comma-separated list using
>> the command line?
>
> Is perl considered cheating ?
>
> ls | perl -e "print join(',', grep { chomp } <>);"

Aha, you beat me to it. I thought there must have been a way to
do this with a one liner but forgot about the possibilities of grep.

If Perl isn't a "unixy" way of doing things, I don't know what is ;)


Ian Barwick


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links