Unix shell help aga...
 

  You don't need to be an 'investor' to invest in Singletrack: 6 days left: 95% of target - Find out more

[Closed] Unix shell help again

6 Posts
4 Users
0 Reactions
45 Views
Posts: 91000
Free Member
Topic starter
 

Can I use tar (or actually jar in this case) to extract a file from an archive and then pipe it directly to sed without having to create a temporary file?

I want to fish a string out of a file in an archive, inside a script.


 
Posted : 10/05/2016 5:35 pm
Posts: 91000
Free Member
Topic starter
 

Ah it's ok, got it. Use unzip instead of jar, so you can use -p to output the file to STDOUT instead of writing it to disk.


 
Posted : 10/05/2016 5:38 pm
Posts: 0
Free Member
 

If it was a tar file and I wanted to find a string inside it I would just use zgrep and then pipe it from there, I'm guessing you could try the same with the jar?


 
Posted : 10/05/2016 5:46 pm
Posts: 7
Free Member
 

Molgrips, amazing how the brain and eye work. When was quickly skimming the subjects in this forum I thought yours was unisex hell, help. Imagine my disappointment.


 
Posted : 10/05/2016 8:15 pm
Posts: 91000
Free Member
Topic starter
 

Most disappointing mis-read ever.


 
Posted : 10/05/2016 8:45 pm
Posts: 0
Free Member
 

As background, molgrips, jar and tar are not related. tar is a UNIX command but jar is one supplied only for java.

Actually, jar is much more like zip than tar.

Rachel


 
Posted : 11/05/2016 10:02 am
Posts: 91000
Free Member
Topic starter
 

Yea I know.. hence use of unzip in the actual solution.


 
Posted : 11/05/2016 10:08 am

6 DAYS LEFT
We are currently at 95% of our target!