zsh-users
 help / color / mirror / code / Atom feed
* Paramater subsiution
@ 2021-06-27 22:40 Lewis Butler
  2021-06-27 22:47 ` Gamma
  0 siblings, 1 reply; 4+ messages in thread
From: Lewis Butler @ 2021-06-27 22:40 UTC (permalink / raw)
  To: Zsh Users

Given:

name="file 1234 - name"
echo ${I% - name}

I can easily get 'file', but how would I get "name" instead given that:

	o name and 1234 are variable lengths and values 
	o "file" and " - " are constant across all the input


I've trued using 

${i:s/file \[0-9\]+ - //}
${i:s/file \[0-9\]\[0-9\]\[0-9\]\[0-9\] - //}
${i:s/file [0-9]+ - //}
${i:s/file [0-9][0-9][0-9][0-9] - //}
${i:s/file [^ ]+ - //}

And similar to no avail, though:

${i:s/file //} 

prints "1234 - name"


-- 
ɹןʇnqן
<mailto:lbutler@covisp.net>
tel:+1.303.219.0564





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

end of thread, other threads:[~2021-06-28 22:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-27 22:40 Paramater subsiution Lewis Butler
2021-06-27 22:47 ` Gamma
2021-06-28  5:34   ` Lawrence Velázquez
2021-06-28 22:33   ` Lewis Butler

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).