![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Differentiate Soft and Hard Link | balu_solaris | UNIX for Dummies Questions & Answers | 4 | 01-23-2009 05:18 PM |
| how to differentiate columns of a file in perl with no specific delimiter | Amiya Rath | Shell Programming and Scripting | 9 | 07-15-2008 12:51 AM |
| differentiate between a file and a device | keith_hampson | UNIX for Dummies Questions & Answers | 6 | 06-01-2008 02:47 PM |
| how to differentiate a file from a folder in a FIND? | denysQC | UNIX for Dummies Questions & Answers | 3 | 06-06-2006 06:02 PM |
| How to Differentiate Between Files and Folders? | dgower2 | UNIX for Dummies Questions & Answers | 6 | 04-28-2006 12:10 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Hi All,
I am new to this unix stuff.I just have one doubt:suppose i have two tar files and sometimes it happens that when we just check these files from outside these two tar files look same Code:
"Eg: ls -lrt drw-r--r-- 1 oasis logadmin 37067 Apr 3 05:48 file1.tar drw-r--r-- 1 oasis logadmin 37067 Apr 3 05:48 file2.tar" ![]() Thanks in advance |
|
||||
|
Hi all,
Thanks for your replies. As i am a newbie to scripting i am not sure how to proceed.I am looking for a script that differentiates between two tar files without extracting(due to space issues) and output the files that have been changed.Please note that these tar files will contain jar files and inside those there are files. The structure is : tarfile :it is an external directory inside that there are jars which are also directories.and inside that there are files.and i have to differentiate between such two tarfiles that wich all files have been changed inside that.it is not always necessary that there is a difference between two tarfiles.It may happen that nothing has changed. I work in java and javascript and am not so comfortable with unix.So requesting your help. Thanks in advance. |
|
||||
|
Quote:
In general, the command Code:
cmp Code:
sum Code:
md5sum So you should begin by determining if the files are indeed different Code:
cmp file1.tar file2.tar file1.tar file2.tar differ: differ: char 6, line 1 Code:
tar tf file1.tar >/tmp/file1.toc tar tf file2.tar >/tmp/file2.toc cmp /tmp/file1.toc /tmp/file2.toc Code:
sdiff /tmp/file1.toc /tmp/file2.toc Code:
[ ! -d /tmp/file1 ] && mkdir /tmp/file1 [ ! -d /tmp/file2 ] && mkdir /tmp/file2 tar tf file1.tar >/tmp/file1/file1.toc tar tf file2.tar >/tmp/file2/file2.toc for f in $(cat /tmp/file1/file1.toc) do cd /tmp/file1 tar xf /path/to/file1.tar $f cd /tmp/file2 tar xf /path/to/file2.tar $f Echo comparing /tmp/file1/$f /tmp/file2/$f cmp /tmp/file1/$f /tmp/file2/$f done |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|