Path: csiph.com!goblin3!goblin2!goblin1!goblin.stu.neva.ru!usenet.stanford.edu!not-for-mail From: Alan Beccati Newsgroups: gnu.bash.bug Subject: Feature request: parameter expansion, replace last occurrence Date: Mon, 30 Jul 2018 16:59:58 +0200 Lines: 31 Approved: bug-bash@gnu.org Message-ID: NNTP-Posting-Host: lists.gnu.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: usenet.stanford.edu 1532965328 13074 208.118.235.17 (30 Jul 2018 15:42:08 GMT) X-Complaints-To: action@cs.stanford.edu To: bug-bash@gnu.org Envelope-to: bug-bash@gnu.org User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 x-msw-jemd-newsletter: false X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] [fuzzy] X-Received-From: 194.95.6.17 X-Mailman-Approved-At: Mon, 30 Jul 2018 11:42:07 -0400 X-Content-Filtered-By: Mailman/MimeDel 2.1.21 X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com gnu.bash.bug:14420 Hi, While programming a script I found it useful to have parameter expansion replace the last occurrence of a given substring instead of the first but fund no way to do it. I hope this is the correct place for feature requests since I found no searchable location for them to check if it was already there. The idea would be to have a third option to the already existing two: |${PARAMETER/PATTERN} # replaces first occurrence| |${PARAMETER//PATTERN} # replaces all occurrences| I was thinking about |${PARAMETER/%PATTERN} but that is already taken by anchored replacement. With best regards, Alan | -- Dr. Alan Beccati Jacobs University Bremen gGmbH Department of Life Sciences and Chemistry Guest scientist at Max Planck Institute for Marine Microbiology Microbial Genomics and Bioinformatics Research Group Celsiusstrasse 1 28359 Bremen Germany Phone: +49 (0) 421 2028 909