Unix/Linux Go Back    

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 Unix and Linux 04-06-2007   -   Original Discussion by lucaspewkas
radoulov's Unix or Linux Image
radoulov radoulov is offline
Registered User
Join Date: Jan 2007
Last Activity: 9 January 2017, 4:40 AM EST
Location: Варна, България / Milano, Italia
Posts: 5,690
Thanks: 184
Thanked 630 Times in 587 Posts

for f in test_suite/*.args;do 
	printf "filename without path and extension: %s, extension only: %s\n" "${fn##*/}" "${f##*.}"  

With bash you can do something like this (if I understand correctly the requirement):

set test_suite/*.args
set "${@##*/}"
printf "%s\n" "${@%.*}">file.out

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