I am running this command on HP UNIX. I have 60 tar files that contain multiple files totaling about 2GB of data in each tar file. The following command is working fine to extract the files. The issue is I don't have enough disk space for all the .tar files and the .dat files it contains to exist at the same time. I want to extract data from FILE1.tar to FILE1A.dat, FILE1B.dat and then delete FILE1.tar before moving on to file FILE2.tar. Is there a way to automatically delete the .tar file once the data has been extracted to the .dat file?
for tarfile in *tar; do tar -xvf $tarfile; done