Solved

Reading contents of Rel223_NIMS_ASC_PLSQL_20061121_01.tar file

Posted on 2006-11-21
4
252 Views
Last Modified: 2010-04-21
I have a tar file: Rel223_NIMS_ASC_PLSQL_20061121_01.tar.gz

I uncompressed the file with:
gunzip Rel223_NIMS_ASC_PLSQL_20061121_01.tar.gz
and it became Rel223_NIMS_ASC_PLSQL_20061121_01.tar

Now i used
tar -xvf Rel223_NIMS_ASC_PLSQL_20061121_01.tar
and unix showed me contents of the above file

$ tar -xvf Rel223_NIMS_ASC_PLSQL_20061121_01.tar
x del_20061121_01, 0 bytes, 0 tape blocks
x del_20061121_01/plsql, 0 bytes, 0 tape blocks
x del_20061121_01/plsql/1_conk_prod_ST.sql, 97337 bytes, 191 tape blocks
x del_20061121_01/plsql/install_nims20061121_01.ksh, 827 bytes, 2 tape blocks
x del_20061121_01/plsql/install_nims20061121_01.sql, 594 bytes, 2 tape blocks
x del_20061121_01/docs, 0 bytes, 0 tape blocks
x del_20061121_01/docs/Rel223_NIMS_ASC_PLSQL_20061121_01_i10.doc, 58880 bytes, 115 tape blocks

All these files are shell, pl/sql files.
I want to read the induvidual files. i.e. i want to read the contents of
del_20061121_01/plsql/install_nims20061121_01.sql etc
how can i do this.
0
Comment
Question by:aman_greval
  • 2
  • 2
4 Comments
 
LVL 48

Accepted Solution

by:
Tintin earned 500 total points
ID: 17993758
What exactly do you mean by "read the contents"?  Do you mean you want to extract and see the contents of a specified file?

If so, then do

gzip -dc Rel223_NIMS_ASC_PLSQL_20061121_01.tar.gz | tar xf - del_20061121_01/plsql/install_nims20061121_01.sql ; cat del_20061121_01/plsql/install_nims20061121_01.sql
0
 

Author Comment

by:aman_greval
ID: 17994989
tar xf - del_20061121_01/plsql/install_nims20061121_01.sql

why this dash here; i did it without it
0
 
LVL 48

Expert Comment

by:Tintin
ID: 17998798
The - in conjunction with the tar -f flag means that the "file" tar is reading from is stdin.

This is useful to pipe tar output to the tar command.

In your original post, you uncompressed the tar file.  There's no need to do that if you do

gzip -dc file.tar.gz | tar xvf -

or if you have a Linux system or system where tar recognises the -z flag, you can simply do

tar zxvf file.tar.gz
0
 

Author Comment

by:aman_greval
ID: 18000162
Thanks for your help Tintin!!
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java performance on Solaris - Managing CPUs There are various resource controls in operating system which directly/indirectly influence the performance of application. one of the most important resource controls is "CPU".   In a multithreaded…
Why Shell Scripting? Shell scripting is a powerful method of accessing UNIX systems and it is very flexible. Shell scripts are required when we want to execute a sequence of commands in Unix flavored operating systems. “Shell” is the command line i…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question