Diff command of two files


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Diff command of two files
# 1  
Old 01-06-2010
Diff command of two files

Hi,

I use the diff command to compare two files and append this output to a file. I would like to now not only produce the differences but be able to output the total number of changes made, the number of new files added and the number of files deleted, is there I can do this using the diff command?

ThanksSmilie
# 2  
Old 01-06-2010
to look for files that have been modified (or created ~ new files) in last 15 days:
Code:
find YOUR_PATH  -mtime -15 -print

to look for files that have not been used in last 15 days; only accessed:
Code:
find YOUR_PATH -type f -atime -15 -print

to count total accessed files in last 15 days under YOUR PATH :
Code:
find YOUR_PATH -type f -atime -15 -print | wc -l

You can try these commands for same directories giving same days to follow changes step by step and then you can redirect the output to a file. I dont know how to see the removed files.

regards

Last edited by EAGL€; 01-06-2010 at 10:30 AM..
# 3  
Old 01-06-2010
Sorry, think I have confused the situation. When using the diff command in general it will show the differences between two files but also it also identifies whether these differences are changed, new files have been added or files have been deleted and this is identified between each line of differences using the lettering a, d and c. I would like to now just simply summarise these diffs so that the total number a, d and c's are shown?

Thanks
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Diff 3 files, but diff only their 2nd column

Guys i have 3 files, but i want to compare and diff only the 2nd column path=`/home/whois/doms` for i in `cat domain.tx` do whois $i| sed -n '/Registry Registrant ID:/,/Registrant Email:/p' > $path/$i.registrant whois $i| sed -n '/Registry Admin ID:/,/Admin Email:/p' > $path/$i.admin... (10 Replies)
Discussion started by: kenshinhimura
10 Replies

2. UNIX for Dummies Questions & Answers

Diff command on two Fastq.gz files

Hello. I have to compare two different fastq.gz files that I concatenated, and then zipped into a new merge fastq.gz file. The files that need to be merged are: Sample-136-P_S7_L001_R1_001.fastq.gz and Sample -136-P_S7_L002_R1_001.fastq.gz They were meged to a new file called:... (1 Reply)
Discussion started by: arcolombo698
1 Replies

3. UNIX for Dummies Questions & Answers

Re:using the diff command

Hi Guys I have a situation where I would like to use the diff command but I would like to see "number" of differences and than send it through and if statement and than view the difference if greater than 1. Eg. diff file1 file2 > than gives the "number" and I than say - if number >1... (3 Replies)
Discussion started by: Prega
3 Replies

4. Shell Programming and Scripting

diff command help

Hi all diff file1 file 2 command will give us op of diff between two file. But it aslo give its position and sign "<" or ">". I dont want position and sign in op. Only diff of content should be come as op. Kindly help me for this. Regards Jaydeep (1 Reply)
Discussion started by: jaydeep_sadaria
1 Replies

5. UNIX for Dummies Questions & Answers

diff command

Is there any option for the diff command (or maybe an entirely different command) that will give you only the text that differs between two files? When I use diff file1 file2, if any text on that line differs from one file to the next it'll print out the entire line. I'd like to see only the text... (2 Replies)
Discussion started by: red baron
2 Replies

6. Shell Programming and Scripting

need help in diff command :

i have 2 file named test1,test2 contents of test1: 1 2 3 --------------------------- contents of test2: 1 2 3 4 5 -------------------------------------------------------- my desired o/p should be: diff test2 test1 4 (5 Replies)
Discussion started by: ali560045
5 Replies

7. Shell Programming and Scripting

diff command

All, How to exclude a directory while diff execution? For ex: To exclude file which we don't want to see diff, we have -x <filename>. Thanks in advance (1 Reply)
Discussion started by: Vichu
1 Replies

8. Shell Programming and Scripting

Find duplicates from multuple files with 2 diff types of files

I need to compare 2 diff type of files and find out the duplicate after comparing each types of files: Type 1 file name is like: file1.abc (the extension abc could any 3 characters but I can narrow it down or hardcode for 10/15 combinations). The other file is file1.bcd01abc (the extension... (2 Replies)
Discussion started by: ricky007
2 Replies

9. UNIX for Dummies Questions & Answers

diff command

Hi, I have 2 files i would like to have a DIFF command: 1.Marks differences between files or 2.Mentions just the differences Thanks :) (7 Replies)
Discussion started by: gilead29
7 Replies

10. Shell Programming and Scripting

diff 2 files; output diff's to 3rd file

Hello, I want to compare two files. All records in file 2 that are not in file 1 should be output to file 3. For example: file 1 123 1234 123456 file 2 123 2345 23456 file 3 should have 2345 23456 I have looked at diff, bdiff, cmp, comm, diff3 without any luck! (2 Replies)
Discussion started by: blt123
2 Replies
Login or Register to Ask a Question