473,398 Members | 2,812 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,398 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 1760
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
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
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
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.