Need help in string filtering (KSH)

Hi all,

I'm interested in printing out only the prefix of a formatted set of filenames. All files of this type have the same 8 character suffix. I'm using KSH.

Is there a command I could use to print the filenames, less the last 8 characters? Was thinking of using sed 's/<last 8 chars>//', but this would not take into the case in which the prefix is the same string as the suffix (a rare, but possible case).

Thanks in advance.

You could do

sed "s/<last 8 chars>$//"

or

while read file
do
  echo ${file%????????}
done < list.txt