From: Lewis Butler <lbutler@covisp.net>
To: Zsh Users <zsh-users@zsh.org>
Subject: Paramater subsiution
Date: Sun, 27 Jun 2021 16:40:39 -0600 [thread overview]
Message-ID: <0CCFA5D7-9723-481E-9E20-D96E7F28D717@covisp.net> (raw)
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
next reply other threads:[~2021-06-27 22:41 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-27 22:40 Lewis Butler [this message]
2021-06-27 22:47 ` Gamma
2021-06-28 5:34 ` Lawrence Velázquez
2021-06-28 22:33 ` Lewis Butler
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=0CCFA5D7-9723-481E-9E20-D96E7F28D717@covisp.net \
--to=lbutler@covisp.net \
--cc=zsh-users@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).