shell - bash chain string manipulations -


i have strings contains foo , end .txt:

myfoo.txt
foobar.txt
fizzfoobuzz.txt

i want replace them removing foo (${string/foo}) , .txt (${string:0:-4}):

my
bar
fizzbuzz

is there way chain both string manipulations instead of embedding them ? if there no bash answer possibility zsh, i'll interested.

by embedding mean:

for string in $(cat strings_file);     echo ${${a/foo}:0:-4} done 


Comments

Popular posts from this blog

angular - DownloadURL return null in below code -

python 2.7 - Given three nested dictionaries, sort the top two nested dictionaries from a value in the innermost dictionary? -