On Thu, Jan 10, 2013 at 1:09 AM, Peter Bailey <[email protected]> wrote:
> Peter Bailey wrote in post #1091614:
>> "Jesús Gabriel y Galán" <[email protected]> wrote in post
>> #1091613:
>>> On Wed, Jan 9, 2013 at 5:00 PM, Peter Bailey <[email protected]>
>>> wrote:
>>>>>> ruby -r pathname -e 'Pathname.glob("*[^1].png").each(&:delete)'
>>>>>
>>>>> Careful, as this skips also filename_11.png, filename_21.png, etc.
>>>>> Building on this:
>>>>>
>>>>> ruby -r pathname -e 'Pathname.glob("*_{[^1],??}.png").each(&:delete)'
>>>>>
>>>>> Jesus.
>>>>
>>>> Excellent. Thanks. Hans is right, though. Dir.glob is unsorted. Is that
>>>> a problem here?
>>>
>>> No, because here we are using the glob facility to do all the
>>> filtering. In the other solution, there was the array returned from
>>> the glob that was being filtered, and so the order was important for
>>> the solution that removed the first entry in the array.
>>>
>>> Jesus.
>>
>> Beautiful. Thanks a lot.
>
> This is what I'm getting. I'm sure i'm missing something simple.
>
> ruby -r pathname -e 'Pathname.glob("*_{[^1],??}.png").each(&:delete)'
> -e:1: syntax error, unexpected $end, expecting ')'

Any chance you are using Ruby 1.8*?  If so I suggest to upgrade to 1.9*.

Kind regards

robert

-- 
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/

-- You received this message because you are subscribed to the Google Groups 
ruby-talk-google group. To post to this group, send email to 
[email protected]. To unsubscribe from this group, send email 
to [email protected]. For more options, visit this 
group at https://groups.google.com/d/forum/ruby-talk-google?hl=en

Reply via email to