I have a script that looks like this I need it to drop the
directory and the gz of the filename. All I want is (test.test2.tar) for f. With this it gives me test.test2.tar.gz. Any help appreciated. Thanks
Example filename
/tmp/backup/test.test2.tar.gz
for i in `ls $dir/*.tar.gz`
do
echo $i
f=`exho $i | awk -F/ '{print $3}'`
gunzip $i
tar xvf $f.tar
gzip $f.tar
Done
directory and the gz of the filename. All I want is (test.test2.tar) for f. With this it gives me test.test2.tar.gz. Any help appreciated. Thanks
Example filename
/tmp/backup/test.test2.tar.gz
for i in `ls $dir/*.tar.gz`
do
echo $i
f=`exho $i | awk -F/ '{print $3}'`
gunzip $i
tar xvf $f.tar
gzip $f.tar
Done