Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Compare contents of two tar files

Status
Not open for further replies.

Wrathchild

Technical User
Aug 24, 2001
303
US
I'm looking to compare two tar files to be able to tell which files aren't in the other. From my research it looks like I can use the 'tar -d' command and write to a file for each tar and then use diff. Just wondering if there's a way to do this in one command? I don't care about differences between files, just looking to compare the file names and get a list of different ones.
thanks!
 
sorry, meant 'tar -tvf' and output to a file, not 'tar -d' I'm still trying to get the correct syntax for 'tar -d'
 
It's looking like I'll need to just tar -tvf the contents of each into a file and compare the files...is it possible to only have the filenames show and not all the other data (permissions, size, etc)? I'm gonna play around with awk and see if I can just get what I need with that.
 
If you don't put v like tar tf tarfile, then I believe the other junk does not appear.


 
ok, so after diffing the 2 toc files of each tar file
deployment.tar contains
file1.txt
file2.txt
file3.txt

backout.tar contains
file1.txt
file2.txt

I get the following:
3d2
< file3.txt

Anyway to just have file3.txt show without the other junk?
 
man comm

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
thanks PVS, comm -3 deployment.txt backout.txt worked just fine

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top