zsh-workers
 help / color / mirror / code / Atom feed
* [golf?] harvesting only the mached part of the matched files
@ 2016-04-25 15:19 Marc Chantreux
  2016-04-25 16:32 ` Bart Schaefer
  0 siblings, 1 reply; 3+ messages in thread
From: Marc Chantreux @ 2016-04-25 15:19 UTC (permalink / raw)
  To: zsh-workers

hello,

i have

	/dev/sg0
	/dev/sg1
	/dev/sg9

i want k as

	k=( 0 1 9 )

so ... i got

	k=()
	: /dev/sg[0-9]##(one:'k+=${REPLY#/dev/sg}':)

any shorter solution ?

regards

marc


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [golf?] harvesting only the mached part of the matched files
  2016-04-25 15:19 [golf?] harvesting only the mached part of the matched files Marc Chantreux
@ 2016-04-25 16:32 ` Bart Schaefer
  2016-04-26 12:31   ` Marc Chantreux
  0 siblings, 1 reply; 3+ messages in thread
From: Bart Schaefer @ 2016-04-25 16:32 UTC (permalink / raw)
  To: Zsh hackers list

On Mon, Apr 25, 2016 at 8:19 AM, Marc Chantreux <khatar@phear.org> wrote:
>         k=()
>         : /dev/sg[0-9]##(one:'k+=${REPLY#/dev/sg}':)

Yours would be better as:
k=( /dev/sg<->(one:'reply=( ${REPLY#/dev/sg} )':) )

But this is probably shortest:
k=( /dev/sg<->(on:t:s/sg/) )


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [golf?] harvesting only the mached part of the matched files
  2016-04-25 16:32 ` Bart Schaefer
@ 2016-04-26 12:31   ` Marc Chantreux
  0 siblings, 0 replies; 3+ messages in thread
From: Marc Chantreux @ 2016-04-26 12:31 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: Zsh hackers list

hello Bart and thanks for helping again

On Mon, Apr 25, 2016 at 09:32:08AM -0700, Bart Schaefer wrote:
> On Mon, Apr 25, 2016 at 8:19 AM, Marc Chantreux <khatar@phear.org> wrote:
> >         k=()
> >         : /dev/sg[0-9]##(one:'k+=${REPLY#/dev/sg}':)
> 
> Yours would be better as:
> k=( /dev/sg<->(one:'reply=( ${REPLY#/dev/sg} )':) )

which is awesome: i missed $reply so many times! i'm very happy it
exits. this one:

	k=( /dev/sg<->(on:t:s/sg/) )

is very nice too! :t is a very good idea.

regards!

marc


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-04-26 12:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-25 15:19 [golf?] harvesting only the mached part of the matched files Marc Chantreux
2016-04-25 16:32 ` Bart Schaefer
2016-04-26 12:31   ` Marc Chantreux

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).