This is a quick tip on how to remove file extension from a filename. Lets say filename is redhat.csv and for us to extract the file name only and leave out the extension.
There is a couple of ways to do it
1. Using BASH built-ins if a variable has the filename assign to it,
[sai@centos66Vanilla ~]$ export VAR="redhat.csv" [sai@centos66Vanilla ~]$ echo $VAR redhat.csv
[sai@centos66Vanilla ~]$ echo ${VAR%.*} redhat
or
[sai@centos66Vanilla ~]$ echo ${VAR%.csv} redhat
2. Using the basename command
[sai@centos66Vanilla ~]$ echo $(basename $VAR .csv) redhat