I have a requirement that i need to store only the filename without its extension. Can anyone please help me to do this.
For Example, i have stored the filename in a varialble called fname. I need to extract all the charecters before the first occurence of the dot.
If fname has value as PG_0008_20050519.xml.gz then i need to extract only "PG_0008_20050519". Please help me to do this.
the first is one with awk
echo `basename <program-path>` | awk -F"." '{print $1}'
this one is with sed but no of characters in extension need to be known in prior
for 3 character extension
echo `basename <program-path>` | sed -e 's/\....//'
advancement to the above method, no of characters in extension need not be known
echo `basename <program-path>` | sed -e 's/\..*//'