Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Paramater subsiution
- X-seq: zsh-users 26781
- From: Lewis Butler <lbutler@xxxxxxxxxx>
- To: Zsh Users <zsh-users@xxxxxxx>
- Subject: Paramater subsiution
- Date: Sun, 27 Jun 2021 16:40:39 -0600
- Archived-at: <https://zsh.org/users/26781>
- List-id: <zsh-users.zsh.org>
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