My intension is, to write a variable "dims" with the output name of the tar-command. That means, that my variable should be named the same as the input scene, but without the extension ".tar". I tought I could write a temp txt, write the output name in it and read it afterwards, but the way I wrote the code, the tar.txt is empty.
This seems to be a simple problem. Could anybody help me with this?
Thank you!
Hm, well, what I need is to unzip the *.tar.gz file. The output is an directory named *. I like to set a variable to *. I need to read files, which the directory * is containing, so I need the name of the directory. The command sed didn`t really help me...
Data in a tar is verbatim like the original except there may be null padding between files, for your tape drive, so the first line of any text file might not be so good.
---------- Post updated at 04:58 PM ---------- Previous update was at 04:55 PM ----------
well, it doesn't work. i've no idea why. can't i just read the name of the variable $SCENE, which stands for the tar.gz or .tar file, without the extension?
variable $SCENE = *.tar.gz
variable $DIMS = *
set DIMS = $SCENE minus .tar.gz
there must be an easy way!
thank you!
---------- Post updated 10-20-10 at 06:48 PM ---------- Previous update was 10-19-10 at 07:14 PM ----------
no one???
---------- Post updated at 09:53 PM ---------- Previous update was at 06:48 PM ----------
If you're willing to use ksh or bash, then there is an easy way, yes:
The % operator causes the contents of the named variable to be examined for the "pattern" that follows between the % and the closing }. If it is there, it is removed and used in the command which is to assign it to DIMS. This doesn't require the start of another process and thus is more efficient than using sed or something else.
If you must use something else, there might be an easy way with the native scripting language (you didn't mention, or I didn't see it), but you can certainly do something like this:
[code]
SCENE=/path1/path2/something.tar.gz
DIMS=`echo "$SCENE | sed 's/.tar.gz//; s!.*/!!'`
Coming from this thread, just wondering if there is an option to check if the Tar of the files/directory will be without any file-errors without actually making the tar.
Scenario:
Let's say you have a directory of 20GB, but you don't have the space to make Tar file at the moment, and you want... (14 Replies)
Quick question,
is it possible to make a Tar of completely directory and placing the tar file in it (will this cause even the tar file to tarred ?)
sample:
/opt/freeware/bin/tar -cvf - /oracle | gzip > /oracle/backup.tgz
will the tar file backup.tgz also include backup.tgz ?
i tried... (5 Replies)
Hello Team,
Would you please help me with a UNIX command that would check if file is a tar file.
if we dont have that , can you help me with UNIX command that would check if file ends with .tar
Thanks in advance. (10 Replies)
I would like to confirm my file.tar is been tar-ed correctly before I remove them. But I have very limited disc space to untar it.
Can I just do the listing instead of actual extract it? Can I say confirm folder integrity if the listing is sucessful without problem?
tar tvf file1.tar
... (1 Reply)
Hi all,
4 files are returned when i issue 'find . -mtime -1 -type f -ls'.
./ora_475244.aud
./ora_671958.aud
./ora_934052.aud
./ora_934050.aud
However, when I issued the below command:
tar -cvf test.tar `find . -mtime -1 -type f`, the tar file only contains the 1st file -... (2 Replies)
Hi,
I am trying to unpack and install .tar.bz2 library.
I was told to cd /
and than tar -jxvf /source-of-library-file?...tar.bz2
to get files unpacked and installed into /
Darius
$ pwd
/
$
$ tar -jxvf /tmp/local/root/ncurses-dev-addon.tar.bz2
ncurses-dev-addon/... (3 Replies)
Hi All
Can someone pls guide me if there any utility to compress file on windows & uncompress on vxworks
I tried as -
- compressed some folders on windows ... i created .tar ( to maintain directory structure ) and compressed to .gz format.
- on VxWorks i have uncompressed it to .tar... (1 Reply)