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

Paramater subsiution



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@xxxxxxxxxx>
tel:+1.303.219.0564







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