From: Emanuel Berg <embe8573@student.uu.se>
To: zsh-users@zsh.org
Subject: translate all sequences of whitespace/underscores to single dashes
Date: Mon, 17 Aug 2015 02:20:12 +0200 [thread overview]
Message-ID: <87r3n2dav7.fsf@nl106-137-147.student.uu.se> (raw)
How can I do this directly and only in zsh, i.e.
not using tr (translate characters)?
# whitespace(s) and underscore(s) -> (a single) dash
new_name=${new_name//[_ ]/-}
new_name=`echo $new_name | tr -s "-"`
Here is the file for context:
http://user.it.uu.se/~embe8573/conf/.zsh/files-fs
Feel free to help me with other issues in that file
as well.
--
underground experts united
http://user.it.uu.se/~embe8573
next reply other threads:[~2015-08-17 0:22 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-17 0:20 Emanuel Berg [this message]
2015-08-17 1:57 ` Kurtis Rader
2015-08-17 8:47 ` Peter Stephenson
2015-08-17 11:27 ` Jun T.
[not found] ` <9D99B267-5DDD-4C5B-A33A-C5A0251A4B9F__19706.0165032328$1439813299$gmane$org@kba.biglobe.ne.jp>
2015-08-17 12:19 ` Stephane Chazelas
2015-08-17 14:51 ` Bart Schaefer
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=87r3n2dav7.fsf@nl106-137-147.student.uu.se \
--to=embe8573@student.uu.se \
--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).