How to check tar file record?


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers How to check tar file record?
# 1  
Old 01-16-2015
How to check tar file record?

Hi Guys,

I had some file which that I made tar their, now I need to know tar file record then how to find it.
# 2  
Old 01-16-2015
Hello aditya321,

If I understood requirement correctly you can use following command to check records in tar file.
Code:
tar --list --file=TEST1.tar
Syntax is tar --list --file=archive-name

In my case output is as follows.
Code:
TEST1/
TEST1/test20
TEST1/test19
TEST1/test17
TEST1/test16
TEST1/test46.ksh
TEST1/sort
TEST1/TEST121
TEST1/TEST12.tar

NOTE: I have tested this command in bash.

Thanks,
R. Singh
This User Gave Thanks to RavinderSingh13 For This Post:
# 3  
Old 01-16-2015
Still I could not understand, please give some more hints.
my tar file name is 1_abs_13jan15.tar.gz
then how to find our record.
# 4  
Old 01-16-2015
If you want to list the contents of your file (you have gzipped tar) try:-

tar -tvzf 1_abs_13jan15.tar.gz

Hope this helps.

Thanks, Steve.
# 5  
Old 01-16-2015
Hello aaditya321,

Could you please try following and let me know if this helps, you can refer man tar for same also.
Code:
Syntax: tar tzvf my-archive.tar.gz
tar tzvf 1_abs_13jan15.tar.gz

Thanks,
R. Singh
# 6  
Old 01-16-2015
You can't find records in a tar archive, just files as explained above and available in the man tar page.
If you want single records, extract the respective file (which you of course need to know), and then extract the records from that file.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to check record delimiter of a file ?

My requirment is for every record of a particular file I've to check for a record delimeter (e.g. "\n") and if any row doesn't have "\n" then report it in error file . Please suggest me to go through this. (4 Replies)
Discussion started by: manab86
4 Replies

2. UNIX for Dummies Questions & Answers

UNIX command to check if file name ends with .tar OR if the file is a tar file

Hello Team, Would you please help me with a UNIX command that would check if file is a tar file. if we dont have that , can you help me with UNIX command that would check if file ends with .tar Thanks in advance. (10 Replies)
Discussion started by: sanjaydubey2006
10 Replies

3. Shell Programming and Scripting

Extract timestamp from first record in xml file and it checks if not it will replace first record

I have test.xml <emp><id>101</id><name>AAA</name><date>06/06/14 1811</date></emp> <Join><id>101</id><city>london</city><date>06/06/14 2011</date></join> <Join><id>101</id><city>new york</city><date>06/06/14 1811</date></join> <Join><id>101</id><city>sydney</city><date>06/06/14... (2 Replies)
Discussion started by: vsraju
2 Replies

4. Programming

Check record

moved (0 Replies)
Discussion started by: ust3
0 Replies

5. Shell Programming and Scripting

check a file is exists in multiple tar file?

I have list of ‘tar' format files in a folder. I want to check a particular file is exists in the tar files. Currently I am using the below command to check the scenario. tar -tvf first.tar | grep ‘myfile.txt' The command able to searched a single ‘tar' file only. But I want to search... (7 Replies)
Discussion started by: k_manimuthu
7 Replies

6. Shell Programming and Scripting

Check length of record

Hi, I have a problem, please help me, I have a flat file like this: P00000000088888888999999999 0000999903 000000000000000000 P00000000077777777000000000 0000999903 000000000000000000 P00000000044444444333333333 0000999903 00000000000000000079875 P00000000066666666111111111 0000999903 ... (5 Replies)
Discussion started by: DebianJ
5 Replies

7. UNIX for Dummies Questions & Answers

tar -cvf test.tar `find . -mtime -1 -type f` only tar 1 file

Hi all, 4 files are returned when i issue 'find . -mtime -1 -type f -ls'. ./ora_475244.aud ./ora_671958.aud ./ora_934052.aud ./ora_934050.aud However, when I issued the below command: tar -cvf test.tar `find . -mtime -1 -type f`, the tar file only contains the 1st file -... (2 Replies)
Discussion started by: ahSher
2 Replies

8. UNIX for Dummies Questions & Answers

how to read record by record from a file in unix

Hi guys, i have a big file with the following format.This includes header(H),detail(D) and trailer(T) information in the file.My problem is i have to search for the character "6h" at 14 th and 15 th position in all the records .if it is there i have to write all those records into a... (1 Reply)
Discussion started by: raoscb
1 Replies

9. Shell Programming and Scripting

splitting a record and adding a record to a file

Hi, I am new to UNIX scripting and woiuld appreicate your help... Input file contains only one (but long) record: aaaaabbbbbcccccddddd..... Desired file: NEW RECORD #new record (hardcoded) added as first record - its length is irrelevant# aaaaa bbbbb ccccc ddddd ... ... ... (1 Reply)
Discussion started by: rsolap
1 Replies
Login or Register to Ask a Question