I have two groups of files in the same directory *fmb
and *fmx
.
I want to learn how to print only the file name of fmb
files, file1.fmb, file2.fmb, file3.fmb
will be printed as file1, file2, file3
.
for f in *.fmb; do printf '%s\n' "${f%.*}"; done
*.fmb
to match all files end with .fmb
${f%.*}
is shell syntax for Parameter Expansion, remove the smallest suffix matched pattern in $f
. Here we remove the extension part .fmb
.Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments