Re: Compare two files

2007-10-05 Thread John W. Krahn
[EMAIL PROTECTED] wrote: Hi Hello, I would like to compare two files by comparing the files dates. If one file shows ls -la May 12 2003 filename and the other name shows the same date they are OK for me (I'm not interested in the time part only the date of the file) But if the dates ar

Re: Compare two files

2007-10-05 Thread Jeff Pang
2007/10/5, Paul Lalli <[EMAIL PROTECTED]>: > On Oct 5, 7:50 am, [EMAIL PROTECTED] (Jeff Pang) wrote: > > 2007/10/5, [EMAIL PROTECTED] > > <[EMAIL PROTECTED]>: > > > > > I would like to compare two files by comparing the files dates. > > >

Re: Compare two files

2007-10-05 Thread Gunnar Hjalmarsson
Jeff Pang wrote: 2007/10/5, [EMAIL PROTECTED] <[EMAIL PROTECTED]>: I would like to compare two files by comparing the files dates. If one file shows ls -la May 12 2003 filename and the other name shows the same date they are OK for me (I'm not interested in the time part only the

Re: Compare two files

2007-10-05 Thread Paul Lalli
On Oct 5, 7:50 am, [EMAIL PROTECTED] (Jeff Pang) wrote: > 2007/10/5, [EMAIL PROTECTED] > <[EMAIL PROTECTED]>: > > > I would like to compare two files by comparing the files dates. > > If one file shows > > ls -la May 12 2003 filename > > and the other name

Re: Compare two files

2007-10-05 Thread Jeff Pang
2007/10/5, Jeff Pang <[EMAIL PROTECTED]>: > 2007/10/5, [EMAIL PROTECTED] > <[EMAIL PROTECTED]>: > > How do I do this in Perl? > > Hi, > > if ( int(-M "file1.txt") != int(-M "file2.txt") ) { > # copy the file > } > Forgot to tell you what's -M in perl,from `perldoc perlfunc`: -M Script start

Re: Compare two files

2007-10-05 Thread Jeff Pang
2007/10/5, [EMAIL PROTECTED] <[EMAIL PROTECTED]>: > Hi > I would like to compare two files by comparing the files dates. > If one file shows > ls -la May 12 2003 filename > and the other name shows the same date they are OK for me (I'm not > interested in the time p

Compare two files

2007-10-05 Thread fredrik . y . andersson
Hi I would like to compare two files by comparing the files dates. If one file shows ls -la May 12 2003 filename and the other name shows the same date they are OK for me (I'm not interested in the time part only the date of the file) But if the dates are not the same I would like to copy o

Re: compare two files

2005-10-11 Thread Jeff Pan
Your code logic says that you want to find lines in '2.txt' that are NOT in '1.txt'. thanks for all answerers. yeah,I have put less attention on that code,and have made a fatal logic error. but the way mentioned by John, putting file's all contents to a hash, maybe somewhat less efficiency when

RE: compare two files

2005-10-11 Thread Bob Showalter
Jeff Pan wrote: > hi, > > Is there a best way to find some lines which exists in both two files? I usually use the Unix comm(1) utility. Its very efficient, but the input files need to be sorted. Google for "ppt comm" and you can find a Perl version. -- To unsubscribe, e-mail: [EMAIL PROTECTED]

Re: compare two files

2005-10-11 Thread John W. Krahn
Jeff Pan wrote: > hi, Hello, > Is there a best way to find some lines which exists in both two files? Your code logic says that you want to find lines in '2.txt' that are NOT in '1.txt'. > Someone has show me a method but it seems a little low efficiency. Not only that but it doesn't work corr

Re: compare two files

2005-10-11 Thread Xavier Noria
On Oct 11, 2005, at 11:18, Jeff Pan wrote: Is there a best way to find some lines which exists in both two files? Someone has show me a method but it seems a little low efficiency. The code is as below: Have you searched CPAN for diff modules? -- fxn -- To unsubscribe, e-mail: [EMAIL PROTEC

compare two files

2005-10-11 Thread Jeff Pan
hi, Is there a best way to find some lines which exists in both two files? Someone has show me a method but it seems a little low efficiency. The code is as below: open (T1,"1.txt") or die "$!"; open (T2,"2.txt") or die "$!"; while(my $line=){ chomp $line; print $line,"\n" unless diff($line)