Loading a tar file into the shell script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Loading a tar file into the shell script
# 8  
Old 01-18-2012
(The "gzcat" approach in post #3 and #4 will not work because the "tar" format is also unsuitable for holding in an environment variable).

Hmm. Reading between the lines this looks like an exercise in how to read a the contents of a zipped tar file without unzipping the original file and (strangely) without using "cp".

Find out the names of files in the archive without affecting the original. Then check manually that they do not exist already.
Code:
cat sample.tar.gz | gunzip | tar -tvf -

Extract the files from the archive without affecting the original.
Be very careful that the file names you checked in the previous command do not exist already.
Code:
cat sample.tar.gz | gunzip | tar -xvf -

# 9  
Old 01-18-2012
gzcat can avoid the gunzip pipe:
Code:
ant:/home/vbe $ ll *.gz
-rw-rw-rw-   1 vbe        bin        78273744 Jan 20  2009 AdbeRdr709_hpux_enu.tar.gz
ant:/home/vbe $ gzcat AdbeRdr709_hpux_enu.tar.gz|tar -tvf -
rwxr-xr-x   0/0      0 Jan  5 21:14 2007 AdobeReader/
rw-r--r--   0/0 217978880 Jan  5 21:14 2007 AdobeReader/HPUXRDR.TAR
rw-r--r--   0/0 6901760 Jan  5 21:13 2007 AdobeReader/COMMON.TAR
rw-r--r--   0/0  28978 Feb 23 14:39 2005 AdobeReader/LICREAD.TXT
rwxr-xr-x   0/0  34771 Jan  5 21:12 2007 AdobeReader/INSTALL
rw-r--r--   0/0  79601 May  5 21:54 2006 AdobeReader/ReadMe.htm

But gzcat is not installed by default on all UNIX and so methyl's option is more likely to work everywhere...
This User Gave Thanks to vbe For This Post:
# 10  
Old 01-18-2012
gzcat is a bit redundant anyway. Any gzip I've encountered lets me do this:

Code:
gunzip < filename | ...


...and on my system, gzcat is nothing but a shell script, which runs gunzip.
# 11  
Old 01-19-2012
Hi All,

Thanks for your replies.

Requirement is as follows:

A shell script need to be written, which holds an executable(I am trying to hold that executable in a shell variable). After executing this script in any Linux machine, it need to copy that executable in a predefined path.

Any ideas, how can i implement this script?

Thanks,
Vinay
# 12  
Old 01-19-2012
This makes no sense in English. Are you able to copy the question verbatim without any additional words of your own?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to make Shell script of using tar command?

Hi Guys, I have to make shell script means tar all files from path /home/admin and move to path /dis/wis/ Please help me. (5 Replies)
Discussion started by: aaditya321
5 Replies

2. UNIX for Dummies Questions & Answers

Executing a tar command with the --exclude option in a Debian shell script.

Hi All, I am trying to execute the following tar command with two --exclude options to suppress extract of the two directories specified. Do I need to single quote the directory paths ?? Many thanks for your help. The relevant code excerpt from the script is: cd /var/www/${SITE} ... (7 Replies)
Discussion started by: daveu7
7 Replies

3. Shell Programming and Scripting

background image not loading in newly thrown html page by shell script

I m trying to throw back html page when a file is found.While throwing back html page, the background image is not coming. I am using Apache server.Please suggest how to resolve... #!/bin/ksh echo -e "Content-type: text/html\n\n" echo "<html><head></head><body background=\"/asc/ppp.jpg\">"... (10 Replies)
Discussion started by: ravi18s
10 Replies

4. UNIX for Dummies Questions & Answers

tar -cvf test.tar `find . -mtime -1 -type f` only tar 1 file

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)
Discussion started by: ahSher
2 Replies

5. Shell Programming and Scripting

unix script for loading a data from a file into database

Hi All, I am trying to load a data from a files in a particular directory to a database.. cd $SCC isql metdb >> ${LOGDATA}/LOAD.LOG < ! load from "${LDATA}/${FORM}.ld" insert into $LOADTABLE ! But it's showing the error "syntax error at line 46 : `<<' unmatched" Can u plz help me... (5 Replies)
Discussion started by: grajesh_955
5 Replies

6. Shell Programming and Scripting

Function loading in a shell scripting like class loading in java

Like class loader in java, can we make a function loader in shell script, for this can someone throw some light on how internally bash runs a shell script , what happenes in runtime ... thanks in advance.. (1 Reply)
Discussion started by: mpsc_sela
1 Replies

7. Shell Programming and Scripting

shell script to selectively tar directory based on date

hye everybody :) , i'm new to the scripting world.. hope you guys can help me out with this one.. i'm trying to identify any directory under /tmp/saya that is created more than one day from the current date.. e.g, today is March 14, so any directory that has time stamp March 13 backwards, i... (2 Replies)
Discussion started by: fara_aris
2 Replies

8. Shell Programming and Scripting

hi.. how to attach a tar file using shell script

Hi, How to attach a tar file using shell script or the command liine.. I following command just send the mail to the person with .txt file as body, I want to send it as attachment. /usr/sbin/sendmail -f "user1@daemon.com" user2@daemon.com <hi.txt The contents of the hi.txt will be... (1 Reply)
Discussion started by: madhumathikv
1 Replies

9. Shell Programming and Scripting

Shell Script for Data loading in Oracle

Hi All I am new to unix. I need a shell script to load a datafile in to oracle. I already have a control file, and data file. all I need is if i execute the shell it must load the data using the ctl file to table. Control file : PAY0001.ctl Datafile : mon_grs_det.dat log file :... (3 Replies)
Discussion started by: raghuraja_r
3 Replies

10. Shell Programming and Scripting

Using tar inside a shell script

Hi, I am using tar cvf inside a shell script to archive files. Is there an option to surpress any prompts which come up if the desired archive name already exists ? Thanks in Advance. Kas. (2 Replies)
Discussion started by: kas7225
2 Replies
Login or Register to Ask a Question