need extract command


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting need extract command
# 1  
Old 09-14-2011
need extract command

Hi,

I am having an file 20110909.tar.gz (path-home/user01/archive/20110909.tar.gz ), contains some log files some csv files

I want to extract that files . if i run "ls" command then their should be display all the log files and csv files on the same path.

please help me to know the command

I have tried

tar ztvf 20110913.tar.gz , using this command i can see the what are the files in tar file.


also tried tar xzvf 20110913.tar.gz ,but cant see the files usnig ls command

Thanks
# 2  
Old 09-14-2011
I am not sure if I understood your problem.

What error message do you get when you try to extract the archive with
Code:
tar xzvf 20110913.tar.gz

?

Maybe the extraction worked but the files are most probably being written to that path they were archived with.
# 3  
Old 09-14-2011
Code:
 
tar xzvf 20110913.tar.gz | xargs ls -l

# 4  
Old 09-14-2011
'tar xzvf 20110913.tar.gz' command is enough for extract the 'tar.gz' format file. If you are not able extract the file by using the 'xzvf' optioin, check your tar utility version and upgrade the latest tar version. This may me help to you.
# 5  
Old 09-14-2011
Code:
[user01@rkfvm10 archive]$ ls
  20110913.tar.gz  log
[user01@10 archive]$ tar xzvf  20110913.tar.gz
tar: Removing leading `/' from member names
/home/user01/software/redeye/cep/adapter/sbpersistence/persistence.log
/home/user01/software/redeye/cep/adapter/sbpersistence/sb-jdbc.log
/home/user01/software/redeye/cep/adapter/sbpersistence/sbd.log
/home/user01/software/redeye/cep/adapter/sbpersistence/UnprocessedData.csv
/home/user01/software/redeye/cep/adapter/sbpersistence/UnprocessedData_20110913082032.csv
[user01@10 archive]$ ls
  20110913.tar.gz

please see above inforamtion carefully

my aim is when i am running ls command an archive path it should display
all the files containing that tar.it should not display again tar file.

please see below which are my requirements, which is not getting me.

Eg:
Code:
[user01@rkfvm10 archive]$ ls
  20110913.tar.gz  log
[user01@10 archive]$ tar xzvf  20110913.tar.gz
tar: Removing leading `/' from member names
/home/user01/software/redeye/cep/adapter/sbpersistence/persistence.log
/home/user01/software/redeye/cep/adapter/sbpersistence/sb-jdbc.log
/home/user01/software/redeye/cep/adapter/sbpersistence/sbd.log
/home/user01/software/redeye/cep/adapter/sbpersistence/UnprocessedData.csv
/home/user01/software/redeye/cep/adapter/sbpersistence/UnprocessedData_20110913082032.csv
[user01@10 archive]$ ls
/home/user01/software/redeye/cep/adapter/sbpersistence/persistence.log
/home/user01/software/redeye/cep/adapter/sbpersistence/sb-jdbc.log
/home/user01/software/redeye/cep/adapter/sbpersistence/sbd.log
/home/user01/software/redeye/cep/adapter/sbpersistence/UnprocessedData.csv
/home/user01/software/redeye/cep/adapter/sbpersistence/UnprocessedData_20110913082032.csv

Moderator's Comments:
Mod Comment Please use [code] and [/code] tags when posting code, data or logs etc. to preserve formatting and enhance readability, thanks. You got a PM with a guide.

Last edited by zaxxon; 09-14-2011 at 06:33 AM.. Reason: code tags, see PM
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Command to extract word from a string

Hi All, I have a word and from that word would like to search for certain set of string, is there any command to do so ? EX : Components from the above word, would like to search for strings set and extract the search string and then do if stmt... pon nen ent Com say... (2 Replies)
Discussion started by: Optimus81
2 Replies

2. Shell Programming and Scripting

Extract particular number from the command output

Hi Folks, I want to use particular number as a variable output..Please find the below for scenario... Example 1:- Below output i want to use secondary group 9003 as a variable output $ id -a |awk -NF '{print $3}' groups=99(local),9003(testadmin) Else I want to use 2006 as a... (8 Replies)
Discussion started by: susindram
8 Replies

3. Shell Programming and Scripting

Extract tty from ps command

When I try to extract tty from ps command , at time we get output , at times we dont. for eg i executed below quesry continulusly for some time,Actually i feel its because sometime pid allocated has some additional space at begining which causes this issue. ->ps | grep "/-ksh" | tail -1 | cut -f4... (2 Replies)
Discussion started by: lalitpct
2 Replies

4. Shell Programming and Scripting

expr command to extract words

how to use expr command to retrieve all the words before the equal sign "=" with shell script (3 Replies)
Discussion started by: 76455
3 Replies

5. UNIX for Dummies Questions & Answers

exp command to extract particular rows

Hi, I'm new to unix so hopefully you can help! I'm using the below command to extract a tables contents and store it in a dmp file: exp OWNER/OWNER@LINK FILE=exp.dat TABLES=TABLE_TEST This works fine and dumps the table into the exp.dat file. What i can't figure out, is how to... (3 Replies)
Discussion started by: boijie
3 Replies

6. Shell Programming and Scripting

extract columns from command output

I need to extract information (for example, file owner, directory path, etc). However, the code below does not work? What is wrong? find /usr/local/www/apache22/data/dev/chown_test -ls for i in * do cut -f 1,2 "$i" | echo done (3 Replies)
Discussion started by: montana24
3 Replies

7. UNIX for Dummies Questions & Answers

Extract time and host IP from 'who' command?

I have been slowly working towards getting a shell window in Cygwin (and/or Gnome and/or KDE) to start up and display the last time it was opened (or sourced) similarly to how the OS X Terminal does so. As close as I've been able to get so far is the 'who' command, but I can't seem to puzzle out... (2 Replies)
Discussion started by: SilversleevesX
2 Replies

8. Shell Programming and Scripting

Extract first file only from ls command

I need help in extracting first file only from an ls command and store it in a local variable I thought using awk we could build something - not very familiar how to do it Something like ls -t $search_string and store the resultant first file alone into a local variable ( as my result... (4 Replies)
Discussion started by: prekida
4 Replies

9. UNIX for Dummies Questions & Answers

command to extract IP data from syslogs

Hello, I need to extract IP info from few large files into a single file with IP info only. I guess I can use grep, uniq and redirection but I not sure how. Is there a way to do this with a single command? Your help is greatly appreciated. (7 Replies)
Discussion started by: di0de
7 Replies

10. Programming

extract command

hey i want to extract an argument from double qoutes, eg: when the user enters: prompt "mile" i need to extract everything within the double quotes, in my case, mile, and save it to a string. feedback/code would be appreciated thanks mile1982 (1 Reply)
Discussion started by: mile1982
1 Replies
Login or Register to Ask a Question