MARG wrote: > Hide like to extract the name and file verion of a tarball from its file > name in a bash script. > > Example: mysql-5.1.15.tar.bz2 > > I want to get only the "mysql-5.0.15" part. > > How can i get this. > Note: the number of dots, varies. > Example: qmail-1.03.tar.gz If the name is in a variable, e.g. $file, then: $ file="qmail-1.03.tar.gz" $ base="${file%.tar.gz}" $ echo "$base" qmail-1.03 -- Glynn Clements <glynn@xxxxxxxxxxxxxxxxxx> - : send the line "unsubscribe linux-admin" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html