compare two text files for matching data

  • Permalink
  • submit to reddit
  • Email
  • Follow


HI 
 
I want to compare data in two separate spreadsheet files and store the matching data in another spreadsheet file.
 
like
 
1)reading data from two spread sheets
2)compare the data of fist one with second
3)writing the matched data to third one.
 
I am find difficulty in combining them to sort string bu string
pls help me in this 
 
thanks 
 
jyohti
0
Reply x9561 (148613) 11/2/2006 6:10:08 PM

See related articles to this posting


You're going to need to provide more information before anybody can provide specific help, such as: - Are these actual spreadsheets, as in Excel spreadsheets, or are these text files in which the information is tab-delimited?
- What are you using to read the files?
 - Is the data 1D or 2D?
- Are you comparing numbers or strings or both?
 - What are you trying to use to compare?
- What are you using to write the result file?
The best things to do is to provide a sample of what you're doing and a detailed explanation of what you're trying to accomplish. In other words, help us to help you.
0
Reply x9561 (148613) 11/2/2006 7:10:07 PM

hi
the spread sheet are like normal excel sheets .
my basic requirement is like comparing two text documents and storing the match data in a new file.
so i started like converting a text document to an array by using 'spread sheet to array' and compare each elements of one array to another array .
but not able to do that
so i asked for help
 
 
 
 
 
0
Reply x9561 (148613) 11/2/2006 9:10:09 PM

kindly go through this attach file
you will get an idea.
 
thanks


req.doc:
http://forums.ni.com/attachments/ni/170/213652/1/req.doc
0
Reply x9561 (148613) 11/2/2006 10:10:08 PM

hi
 
i am implementing the following logic 
 
1)  textfile1--------->string to array
                               
2)textfile 2--------->string to array
 
3) compare the elements (substring) of one array to other using for loop
 
4)append the match to an array every time you find a match betwwen two arrays
 
5)wriitng the result in new file
 
i am strugulling in with 3) i have finshed 1,2,4and 5 th part
 
problelms are with indexing and loop conditions for me...
 
anyways i am trying and feeling like i will finish and post that soon....
 
 
 
0
Reply x9561 (148613) 11/2/2006 11:40:08 PM
comp.lang.labview 35384 articles. 14 followers. Post

4 Replies
322 Views

Similar Articles

[PageSpeed] 8


  • Permalink
  • submit to reddit
  • Email
  • Follow


Reply:

Similar Artilces:

Comparing two input files
Hi there, I need a bit help. Here's my "compare-function": -------------- function comp(file1,file2) % ====================================== % Matlab script to compare 2 input-files % ====================================== % Read first character into char array (skipping rest of line) [file1_data]=textread(file1,'%3c%*[^\n]') [file2_data]=textread(file2,'%3c%*[^\n]') % Read the file like this, using NaN in empty cells: [data] = textread('data.csv','','delimiter',',','emptyvalue',NaN); -------------- As you see, it...

Compare Two Text file and update files only for missing entries ...!!!
We have index file (.txt) at Repository folder(local machine) as well as at the destination(USB device). Each index file is having more than 30000 Entries. Index file entry contains Driver name, PnPID and Path of INF file. Here Single INF file can have multiple entries. when we copy the repository folder from Source location to Destination, first We need to Compare Two index Files. And find out the exact missing entries that are present in source index file but not in destination index file. And we need to update index file as well as copy only those files for missing entries at...

data comparing....Two files.....
Dear all!! I have file of 3 fields and a master file. I want to compare two fields of my file with master file corresponding fields. My file UniqId Amount Name 123 345.00 Donald 356 458.00 Duck 789 356.00 Robert Master 123 345.00 Donald Add1 Add2 Add3 356 458.00 Duck Add1 Add2 Add3 789 356.00 Robert Add1 Add2 Add3 125 588.00 Mc Add1 Add2 Add3 I want to check the first two fields with the corresponding Master fields. If both fields matches with the master fields then print Myfile fields and all master fields. If the ...

compare two text files
Hi, I want to compare two text files(contains numbers) and I need a shell script for this to get what are the simmilar fiels and the differents fiels in these two text files (the result can be in another files). an example of these two files: file1: 34556678 33236789 32223456 31458909 30113256 file2: 33557890 31458909 33236789 30113256 33556788 Thanks a lot for your help. On 22 Feb., 11:04, "Unix_shell" <marouane.s...@gmail.com> wrote: > Hi, > > I want to compare two text files(contains numbers) and I need a shell > script for this to get what are the simmilar f...

Comparing Two Text Files
Hi all, As everyone is probably aware, I'm weak when it come to VB. But I'm also very interested in learning more about it. How do I compare two text files? I want to be able to compare FileA with FileB. If the two text files have the same text (customer number) then line from FileA and FileB into FileC. If I have a file that columns seperated by "," and another that has columns seperated by "|", how do I print only a portion of each file. Say I want to print a row of text, but start at the third word in. Logically it makes sense to count "," but I'm...

Comparing two data files
Would you help me to solve the following problem: Two persons entered the same data in SPSS. So I have two separate SPSS-Files with identical variables names and number of cases. I want to check whether each value in the two data files are exactly the same by using SPSS (syntax) program. I have to compare two data files repeatedly, so the program should have a general form. It would be helpful if the output would list for each case (ID) the differences for each variable (see the example below). Example File 1 ID v1 v2 v3 vn 1 1 3 55 6 2 2 5 57 7 3 2 4 59 4 File 2 ID v1 v2...

How to compare two large text files?
Hi,I have two text files, text1.xml and text2.xml. text1.xml is the bench mark file and text2.xml is generated by my Java program. In my junit test, I want to compare the generated text2.xml against the bench mark file text1.xml. The bench mark file text1.xml is much bigger than text2.xml, because it has other lines in it. All the lines in text2.xml, except a few lines containing timing information, should find a match in text1.xmlIn another words, lines 2 to 1101 in text2.xml should be identical with lines 850 to 1949 in text1.xml; lines 1103 all the way to the end in text2.xml should be iden...

want to compare data in two files.
I have two CSV files and i want to find the duplicates records. For ex. Sheet1 Sheet2 Vipul Anthony John Wayne Mac Bill smith randy Nick thalia Trishi ricky sachin Nick So i want to check th...

comparing data in two mat files
Hi, Is there any quick way to compare data in two mat files? These mat files are huge...the dimension is 17544 x 1000. Therefore, it may be too slow to first convert them to CSV files and compare. Thanks, Alan ...

Compare the size of two text files
Hello Is there a possibility in matlab to comare two files, which on is bigger in size? Cheers Silvija Hi Silvija, help dir dir called as a function returns among other things the size... Titus "Silvija" <silvija_no@hotmail.com> schrieb im Newsbeitrag news:ef347aa.-1@webx.raydaftYaTP... > Hello > > Is there a possibility in matlab to comare two files, which on is > bigger in size? > > Cheers > Silvija ...

comparing two files for best match
--nextPart2049084.fqK7v6JRGL Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7Bit Hi, I have two files that look something like below: File 1 ---- 25.06.12,13:00:02,44,45 25.06.12,13:00:08,43,45 25.06.12,13:00:14,44,45 25.06.12,13:00:20,44,45 25.06.12,13:00:26,43,45 25.06.12,13:00:32,43,44 25.06.12,13:00:38,43,44 25.06.12,13:00:44,43,44 25.06.12,13:00:50,43,44 25.06.12,13:00:56,43,44 25.06.12,13:01:02,43,44 File 2 ---- 13:00:04,stop_hge,5.31,2.68,21.69,79.8,42.8,52.6,216,18 13:00:16,stop_hge,5.3,2.68,21.65,79.5,42.5,52.3,215,17...

is there a utility to compare two non-text files?
I know I can use diff to compare two text files but is there a utility to compare two large non-text files? RolandRB said the following, on 03/29/06 14:43: > I know I can use diff to compare two text files but is there a utility > to compare two large non-text files? > If you have the GNU utilities, there is cmp(1). -- Rich Gibbs richg74@gmail.com "You can observe a lot by watching." -- Yogi Berra On 2006-03-29, RolandRB wrote: > I know I can use diff to compare two text files but is there a utility > to compare two large non-text files? cmp -- Chris F.A....

Comparing two book chapters (text files)
Hi all, So I have an interesting challenge. I want to compare two book chapters, which I have in plain text format, and find out (a) percentage similarity and (b) what has changed. Some features make this problem different than what seems to be the standard text-matching problem solvable with e.g. difflib. Here is what I mean: * there is no guarantee that single lines from each file will be directly comparable -- e.g., if a few words are inserted into a sentence, then a chunk of the sentence will be moved to the next line, then a chunk of that line moved to the next, etc. * Also, ...

Fastest algorythm for... (comparing two text files)
Two text files containing simple lists of strings: ____________ File #1: Aaaa Ffff Gggg Hhh X C File #2: Aaaa NewEntry#1 Ffff Gggg Hhh NewEntry#2 X C ____________ What is the fastest way in VB6 to compare the two files, and find entries in File #2 that are not in File #1? (i.e. "NewEntry#1" and "NewEntry#2"). I know I can open file #2 and compare each line to all lines in file #1 with two nested loops, but there has to be a faster way... right? :-) TIA Calan > Two text files containing simple lists of strings: >...

Matching data from two files using Python programmability
Hi all I am trying to learn Python for SPSS and I found an interesting post on the SPSS DevCentral site about how it is possible to take two files and match them to each other so that you can get certain geographical information. For example in File 1, I have Zipcodes Cities And these cases are all unique, because they are a sample from survey data. In File 2, I have a master file that lists all geographical information in US, which I got from Geonames.org : Zipcode State City Geolocation (latitude and longitude) If I wanted to use some kind of vlookup function to map...

compare 2 data files and extract fields for matched lines
Hello Friends, The best way to describe what I'm trying to do is through an example. I have 2 pipe delimited input files and want to extract a field from file 2 and append it to file 1. Note I would like Output file to have the same number of rows as Input File 1, with an additional field whose value if present in file 2, should be inserted in this new field. If its not present, then insert '0000'. Input File 1 (zipcode, city, state, county) 36003|Autaugaville|AL|AUTAUGA 36006|Billingsley|AL|AUTAUGA 72314|Birdeye|AR|CROSS 72324|Cherry Valley|AR|CROSS 57437|Eureka|SD|MCPHERSON 67...

Reading two different types of data from one text file?
Hey Everyone, Another begginer here, I am trying to extract read some data from a text file, data looks like this: a b c d e a b c d e .... .... .... a b c d e a=being string b= being double etc I can read those fine in an 1x5 cell array and than use the data with { }. The problem is when my text file looks like this: a b c d e a b c d e .... a b c d e q y x q y x q y x .... q y x Is there a way to read the first part of the textfile in 1x5 cell array and than read the second part into another 1x3 cell array? I am sure there is and I would like to figu...

Reading text data file with variable that span two lines
Hi, We have problems reading with large text data files. Here is an example of a data record: 80252DAA2392E78F|ON|9443585627E258C81034E81A5C1B7673|CF1E0B872335F7AAB32DDE0 208B41940|02|F|19820910|110387|20021008|20021008|REJ|02231880|MATERNA PRENATAL/POSTPARTUM VITAMIN AND MINERAL SUPPLEMENT||100| 16.99| 6.47| 23.46| .00| .00| .00| .00| .00| .00| .00| ..00|000097814|100|2070|0000|0000|0000|0000|0000|0000||753F79BD7410E567E1A1C1 1DBCDA FA1B|Y|0 Thus for the problematic data files, the some records span more than one line, but more problematic is that...

Comparing two text files with non-adjacent lines for unique entries
I am trying to find an easy and fast way to compare two files, each with several thousand lines - only one column and spit out what is unique only to one of the files. So, compare file A and file B, and only lines that re unique to file A are spit out to a new file.. comm and diff / sort and Uniq do not work because in this case the two files will have non-adjacent lines. Any help is GREATLY appreciated. Thank you in advance! -TT <tntelle@yahoo.com> wrote in message news:1187142111.587829.251580@q3g2000prf.googlegroups.com... > I am trying to find an easy and fast way to compare...

Code help to Compare two data sets and remove records that match
Hi, I need help to perform the following operation. I want to compare two data sets and remove the rows from data set 1 which matches with data set 2. data set 1 data set name :Temp variable :cust_id 111 222 333 444 555 666 data set 2 data set name :Temp1 variable :cust_id 222 333 data set want data set name :Temp3 variable :cust_id 111 444 555 666 Any small help is much appreciated ...

Re: Reading text data file with variable that span two lines
I'm unclear on what constitutes a correct record. While I can see that "Materna prenatal" is split across two lines, I don't know what the first column of the record will contain. The first two lines imply that it is a string like "80252DAA" but that pattern doesn't repeat in your example. If the first record is the first line, and the second record spans lines 2 to 7 then you need to start by writing the data rules in English. Something like: The record starts with classification code which is of the form "kiwehxiuweyhw". The record ends where the...

Re: Reading text data file with variable that span two lines #5
Thanks all for your answers, As I can see from the responses, fixing these files will be cumbersome. As was suggested, we decided to first go back to the data provider to see whether they could fix their datasets, which is the easiest solution. If that is not feasible then we will see what approach appears the best suited for this task. I might be inclined to use Perl to preprocess the file, though it might a good experience to do it in SAS. There are two issues to fix with those files. First we need to remove empty lines. Second, we need to reconstruct the data record properly. The pr...

Re: Reading text data file with variable that span two lines #4
> -----Original Message----- > From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On > Behalf Of Dominc Mitchell > Sent: Wednesday, March 21, 2007 5:01 PM > To: SAS-L@LISTSERV.UGA.EDU > Subject: Reading text data file with variable that span two lines > > Hi, > > > > > > We have problems reading with large text data files. Here is > an example of > a data record: > > > > 80252DAA2392E78F|ON|9443585627E258C81034E81A5C1B7673|CF1E0B872 335F7AAB32DDE0 > 208B41940|02|F|19820910|110387|20021008|20021008|REJ|02231880|MATERNA > PR...

Re: Reading text data file with variable that span two lines #6
mitchell.d@VIDEOTRON.CA wrote back: > > > -----Original Message----- > > From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On > > Behalf Of Dominc Mitchell > > Sent: Wednesday, March 21, 2007 5:01 PM > > To: SAS-L@LISTSERV.UGA.EDU > > Subject: Reading text data file with variable that span two lines > > > > Hi, > > > > > > > > > > > > We have problems reading with large text data files. Here is > > an example of > > a data record: > > > > > > > > 80252DAA2392E78F|ON...