diff file and previous version


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting diff file and previous version
# 1  
Old 03-25-2008
diff file and previous version

Im trying to diff two files. The first one I will be given. The second one I must find based on previous version created.

For instance here are the files

file_1 - created 3/22/08
file_2 - created 3/23/08
file_3 - created 3/24/08
file_4 - created 3/25/08

then I put in this code
" find . -name 'file_*' -mtime -1 -print > most_recent_file "
this finds any file in the previous directory that contains file_* from 1 day ago and prints it to most_recent_file

now my question is, is there a way I can diff this file with the previous version file_3
# 2  
Old 03-26-2008
Code:
ls -1tr file_* | tail -1

will give you the latest file. save that result to a variable, then you can start using diff.
Login or Register to Ask a Question

Previous Thread | Next Thread

6 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Copy a file from directroy/ prior version to the directory/ new version

How to copy a file from directroy/ prior version to the directory/ new version automatically. (4 Replies)
Discussion started by: roy1912
4 Replies

2. Shell Programming and Scripting

Remove previous line if next & previous lines have same 4th character.

I want to remove commands having no output. In below text file. bash-3.2$ cat abc_do_it.txt grpg10so>show trunk group all status grpg11so>show trunk group all status grpg12so>show trunk group all status GCPKNYAIGT73IMO 1440 1345 0 0 94 0 0 INSERVICE 93% 0%... (4 Replies)
Discussion started by: Raza Ali
4 Replies

3. Shell Programming and Scripting

.procmailrc and uudeview (put attachments from diff senders to diff folders)

Moderator, please, delete this topic (1 Reply)
Discussion started by: optik77
1 Replies

4. UNIX and Linux Applications

Autosys job modified - Need to see previous version

Hi All, Is it possible in any way to check the previous parameters of an Autosys job once the job is modified in the database? Please throw in some light on the hows and whys of this... Thanks!!! (3 Replies)
Discussion started by: pranavagarwal
3 Replies

5. Shell Programming and Scripting

Previous log and diff

Logs are created on a daily basis, the format of the log file is: servername_yymmdd. I need to check if there is a difference in the log created today with the previous one. I would appreciate help on how I can step back to the previous log and how can I test if there is a diff in the logs. ... (4 Replies)
Discussion started by: gugs
4 Replies

6. 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