I have a directory of files with the following naming scheme:
<project name>-<group name>.txt
I want to extract <group name>
from the files I am looping through:
#!/bin/sh
for f in *; do
echo "group name: ${f}"
done
How can this be done? I am experimenting with ${f##...}
and ${f%...}
but without success so far. I am unsure if they can be combined, so I can first leave out the prefix <project name>-
and then leave out the suffix .txt
.