👤
Home Man
Search
Today's Posts
Register


separating filename and extension

Shell Programming and Scripting




Kindly Note - This is a Single User Post by Forum Member radoulov Regarding:
separating filename and extension.
Please Follow The Primary Link Above to View the Full Discussion.

Old 04-06-2007
Code:
for f in test_suite/*.args;do 
	fn="${f%.*}" 
	printf "filename without path and extension: %s, extension only: %s\n" "${fn##*/}" "${f##*.}"  
done

With bash you can do something like this (if I understand correctly the requirement):
Code:
set test_suite/*.args
set "${@##*/}"
printf "%s\n" "${@%.*}">file.out


Last edited by radoulov; 04-06-2007 at 07:40 AM..