?
Solved

Cat files within a tar file to a pipe, without extract the files to disk first (UNIX)

Posted on 2007-10-17
6
Medium Priority
?
3,353 Views
Last Modified: 2013-12-27
Hello,

I'd like to 'cat' a specific file within a tar file without having to extract it to disk.

Then I'd like to run that output to a pipe, so that I can pipe to commands like cut to format the output.

My OS is Sun Solaris UNIX.

Thank You!! :)
0
Comment
Question by:mj62mj62
  • 3
  • 2
6 Comments
 
LVL 62

Assisted Solution

by:gheist
gheist earned 400 total points
ID: 20092062
Ramdisk? tar, pax , whatever are not intended to rename files.
0
 
LVL 40

Accepted Solution

by:
omarfarid earned 800 total points
ID: 20092509
Hi,

One way I know to do what you are trying to do.

tar single file and compress it (to save space) with e.g. gzip.

Now to extract the file without having to uncompress and restore to disk, use gzcat -c compressedfile and pipe the out put to whatever command to format output.

I could not find a way to do it for multiple files tared and compressed.

0
 
LVL 9

Assisted Solution

by:svs
svs earned 800 total points
ID: 20092562
Native Solaris tar doesn't support this, but GNU tar does (option --to-stdout).
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 40

Expert Comment

by:omarfarid
ID: 20092662
Hi,

svs is correct.

The man page for GNUtar:

http://www.hmug.org/man/1/gnutar.php

Solaris 8 (sparc) download:

ftp://ftp.sunfreeware.com/pub/freeware/sparc/8/tar-1.18-sol8-sparc-local.gz

If you have other versions of solaris, then please visit www.sunfreeware.com and look for your version of solaris then look for tar package.
0
 
LVL 9

Expert Comment

by:svs
ID: 20092808
Actually, he should use blastwave -- http://www.blastwave.org/, not sunfreeware.
0
 
LVL 40

Expert Comment

by:omarfarid
ID: 20093022
Hi,

sunfreeware.com provides both compiled and source code of the package. Any particular reason for not downloading from this site?
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
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.
Suggested Courses
Course of the Month7 days, 22 hours left to enroll

615 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