shell - bash chain string manipulations -
this question has answer here:
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
Post a Comment