Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Substituting all but a trailing digit/number



Peter Stephenson <pws@xxxxxxx> wrote in news:200707131248.l6DCmHAI018710
@news01.csr.com:

> zzapper wrote:
>> 
>> I want to generalise top3 into top4,top5..etc
>> 
>> But how could I get filter just the trailing number (in VIM I would use 
>> memory)
> 
> Use
> 
>   num=${(M)0%%<->}
> 
> The (M) tells the shell to substitute the matched part instead of
> removing the matched part.
Thanks Peter,
And If I wanted to anchor the number to the end?



-- 
zzapper
http://www.rayninfo.co.uk/vimtips.html



Messages sorted by: Reverse Date, Date, Thread, Author