Solved

Reading contents of Rel223_NIMS_ASC_PLSQL_20061121_01.tar file

Posted on 2006-11-21
4
243 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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

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 navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
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.

760 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now