473,399 Members | 3,603 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

compare two datr files

hi i have two dat files foldername06.dat(created on feb 13) and p_06(created on feb 16)

both the files are output files and are same except the date which occurs on each line of the output


now i have to write a perl code to compare only the two files not considering the date part such that they are equal .


please let me know the code
Feb 19 '08 #1
3 1409
it will be helpful for us if you can mention the file format.

i am assuming the file format as below

date:file contents
Option-1
in the above case take the lines if the file and use split(/:/,$lineInFile1) to get the contents and use the same to compare both files by what way you require.

Option-2
use split and get the file contents and then generate 2 temp files for both of your files and then use unix commands to check whether both the files are same not [like cmp, diff commands in unix]

-Nagendra


hi i have two dat files foldername06.dat(created on feb 13) and p_06(created on feb 16)

both the files are output files and are same except the date which occurs on each line of the output


now i have to write a perl code to compare only the two files not considering the date part such that they are equal .


please let me know the code
Feb 19 '08 #2
numberwhun
3,509 Expert Mod 2GB
hi i have two dat files foldername06.dat(created on feb 13) and p_06(created on feb 16)

both the files are output files and are same except the date which occurs on each line of the output


now i have to write a perl code to compare only the two files not considering the date part such that they are equal .


please let me know the code
This sounds like it could very well be homework for school. Not only is that against the site policy, but we also require that you do as much of the work (coding) as possible, in order to aid in your learning.

That said, show us your code that you have tried and we will lend assistance.

Regards,

Jeff
Feb 19 '08 #3
numberwhun
3,509 Expert Mod 2GB
it will be helpful for us if you can mention the file format.

i am assuming the file format as below

date:file contents
Option-1
in the above case take the lines if the file and use split(/:/,$lineInFile1) to get the contents and use the same to compare both files by what way you require.

Option-2
use split and get the file contents and then generate 2 temp files for both of your files and then use unix commands to check whether both the files are same not [like cmp, diff commands in unix]

-Nagendra
Nagendra,

Please do not go assisting OPs with questions related to Homework. It is against the site policy.

Regards,

Moderator
Feb 19 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Nicolas Fleury | last post by:
Hi everyone, Is there a way to compare recursively two objects (compare their members recursively)? I'm only interested in equality or non-equality (no need for lower-than...). Thx and...
8
by: Vincent | last post by:
has any one seen a program to compare mdbs'. I have ran into a few of them, but none seem to really do that job. Basically what I need to do is, take 2 access mdb's and check the differences...
2
by: SP | last post by:
Hi All, I need to compare two files line by line and copy the differing lines to a new files. I.e. Compare file1 and file2 line by line. Copy only differing lines to file3. I tried a couple...
5
by: drabee | last post by:
Please help 2 things: 1-I need c# code to compare 2 audio files .or any other .net code 2-code to receive bluetooth file from mobile and save it using .net code
0
by: bobbymusic | last post by:
In my form I have two rich text boxes.In both of them I put two different text files(.txt or .rtf).I looking for some code to compare them, and to have the result as marked differences into the...
6
by: yinglcs | last post by:
Hi, i have 2 files which are different (1 line difference): $ diff groupresult20070226190027.xml groupresult20070226190027-2.xml 5c5 < x:22 y:516 w:740 h:120 area: --- But when I use the...
8
by: Perl Beginner | last post by:
I am new to Perl and new to this site. I have the same question that I keep seeing, but not finding an answer…why doesn’t the compare function work? I’ve been going at this for a while. My code is...
1
by: =?Utf-8?B?RGFuaWVsIERpIFZpdGE=?= | last post by:
II want to compare how many seconds there are between files. If the files are within a 1 - 10 second range I want to copy them to their own folders. What I have so far is a couple methods that take...
12
by: blackirish | last post by:
Hi all, I am trying to merge 2 XML files that first of all i need to compare nodes of both files according to 2 attributes in the nodes. If those 3 attributes are equal, i need to replace the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.