Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #14420 > unrolled thread

Feature request: parameter expansion, replace last occurrence

Started byAlan Beccati <abeccati@mpi-bremen.de>
First post2018-07-30 16:59 +0200
Last post2018-07-30 16:59 +0200
Articles 1 — 1 participant

Back to article view | Back to gnu.bash.bug


Contents

  Feature request: parameter expansion, replace last occurrence Alan Beccati <abeccati@mpi-bremen.de> - 2018-07-30 16:59 +0200

#14420 — Feature request: parameter expansion, replace last occurrence

FromAlan Beccati <abeccati@mpi-bremen.de>
Date2018-07-30 16:59 +0200
SubjectFeature request: parameter expansion, replace last occurrence
Message-ID<mailman.4418.1532965327.1292.bug-bash@gnu.org>
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

[toc] | [standalone]


Back to top | Article view | gnu.bash.bug


csiph-web