473,386 Members | 1,779 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,386 software developers and data experts.

Looking for script to compare entries of new file(File2) in already existed file F1

365 100+
I am looking for script to compare a new entry from File2 in File1:

I have Two files, once file (File1) contains e-mail ids which are already sorted and another file (File2) contains new e-mail ids received, I want to see if those ids (File2) are already existed in file1. Can I get a shell script or program for that?

File1:
xyz1@email.com
xyz2@yahoo.com
xyz3@gmailcom


FILE2:
abc@gmail.com
abc1@gmail.com

I want to insert all FILe2 entried into File1, if entry exists in File1, then I want to ignore.
May 25 '10 #1
3 1758
RedSon
5,000 Expert 4TB
You can use the "diff" command. Type diff --help or man diff.
May 25 '10 #2
tvnaidu
365 100+
The first file (FILE1) contains atleast 1500 entries, second file (File2) contains only 100 entries, If I merge second file into first one, I might have duplicate entries, I want to read one one entry from second file (File2) and compare that entry against first file, if that entry doesn't exist, then I wanto to insert that entry intyo first one, like that all entries in second file should get verified, if not there, then insert that entry into first one.
May 25 '10 #3
RedSon
5,000 Expert 4TB
Then you want to use "diff" and "patch" in your script. First you diff, then you apply that diff on the other file with patch.
May 25 '10 #4

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

Similar topics

6
by: Giulio Neri | last post by:
Hi, I have a short basic script to upload files. It works fine with small files, but with longer files it gets stuck. Here's the fragment, the input file is loaded in "$file" from an HTML form...
8
by: nicholas4 | last post by:
I need help with writing a script that returns a zip file. if(1 == $download){ // Setup headers for zip file // Return zip file // Afterwards, display previous php page } Can you help with...
7
by: priya.tweety | last post by:
How to call a js file from another js file?
18
by: Conrad F | last post by:
Hello all, I am waiting for receipt of files in a directory. I use the FileSystemWatcher to detect when files arrive in said folder. I need to read the data from these files ASAP but the files...
7
by: emanshu | last post by:
HI all, I an designing an application in C++. i want to open file requested by end user but i want to reflect an error to user if file is already opened by some other application.. will anybody...
2
by: Roy Gourgi | last post by:
Hi, How could I append a text file to another text file. Let's say that I have a File1 and I want to append File2 at the end of File1, how would I do that? TIA Roy
12
by: pac | last post by:
I'm preparing to distribute a Windows XP Python program and some ancillary files, and I wanted to put everything in a .ZIP archive. It proved to be inordinately difficult and I thought I would...
20
by: Johan | last post by:
How can I include one XML file into another XML file (on the client side, in Firefox)? I think XInclude is just what I need, but Firefox doesn't support it:...
1
by: jinyi0406 | last post by:
Hi all!! How do you convert a HEXADECIMAL file into a DECIMAL file? Contents of the Input file: 1) Hexadecimals 2) File has got 1000 entries 3) There are 10 fields of variable length,...
185
by: jacob navia | last post by:
Hi We are rewriting the libc for the 64 bit version of lcc-win and we have added a new field in the FILE structure: char *FileName; fopen() will save the file name and an accessor function will...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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...

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.