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
but when we check inside that we may find there are some jars which have been changed.Now i want to have one script which will compare these two tars and then provide as output those jars inside these two tars which have been changed.Pardon me for any grammatical mistakes.
you can use cksum command to see if the checksum of the tar files are same. But for identifying the changed files, you have to extract the tar(tar -xvf) and compare the files.
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.
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.
In general, it is not possible to know which file has changed by looking at the size of the file or the time stamp.
In general, the command
will report the byte at which the first difference is found.
or (better)
are statistically highly likely to work. Well, the chances of md5sum reporting the same hash value for two different files is vanishingly low, but cmp is probably faster.
So you should begin by determining if the files are indeed different
If they are, you should next compare the table of contents:
If the TOCs differ, then use sdiff
If the TOC does not differ, you will need to extract the files from the two .tar files, one by one, and cmp these extracted files.
Hello All,
I have 2 Type of files.
1. MYTEST001_RKP_DORALDO_20150402120000.zip
2. CMP001_STD001_MOGANO_RPSL_20150409_C.zip
I can receive these Two type of file at one location.
If i receive second type of file
CMP001_STD001_MOGANO_RPSL_20150409_C.zip I have to process without... (9 Replies)
Im using code below comparing and getting the diff of two files.
But what about multiple files? can you help me guys
diff -u file1 file2|sed -n '/^---/!{/^-/s/-//p}'
diff -ui file1 file2| sed -n '/^++/!{/^+/s/+//p}'
Example
File1:
aaa
bbb
ccc
ddd
File2:
bbb
eee (5 Replies)
I need a script file for backup (zip or tar or gz) of old log files in our unix server (causing the space problem). Could you please help me to create the zip or gz files for each log files in current directory and sub-directories also?
I found one command which is to create gz file for the... (4 Replies)
Hi all,
I have a tar file and inside that tar file is a folder with additional tar.gz files. What I want to do is look inside the first tar file and then find the second tar file I'm looking for, look inside that tar.gz file to find a certain directory. I'm encountering issues by trying to... (1 Reply)
Hi,
I want to differentiate between a MS Word and Excel file in Unix (not by extension). The condition which we are currently checking for is the pattern "\320\317\021\340" within first 40 bytes of the file. However this format is same in all MS Office files. Can somebody tell me any special... (4 Replies)
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)
Hi,
On my Unix Server in my directory, I have 70 files distributed in the following directories (which have several other files too). These files include C Source Files, Shell Script Source Files, Binary Files, Object Files.
a) /usr/users/oracle/bin
b) /usr/users/oracle... (1 Reply)
I downloaded what I thought was a gziped file (at least on remote server it had a .gz extention) and once I had it it was filename.tar.tar..I tried the standard untar tar -xvf filename on it and get an error. Does anyone know what's going on? (5 Replies)
Hi All,
I'm a rookie using HPUX and I know this is going to sound like a bonehead question, but when I list the contents of a directory, how can I determine which objects are files and which are folders? I'm using the ll and ls commands to lists the contents. So far I've been determining the... (6 Replies)