How to find lines with the same fields in two text files

Key words: txt comparison

Is there any convenient tool for file content comparison? For example, for the old.txt and new.txt files, the first line is the column name. We need to retrieve the same content of the name field in the files. Some data are as follows:

Old.txt

New.txt

Name   Dept

Rachel Sales

Ashley R&D

Matthew   Sales

Alexis Sales

Megan  Marketing

Name   Dept

Emily  HR

Ashley R&D

Matthew   Sales

Alexis Sales

Megan  Marketing

The expected result is as follows:

undefined

In terms of text comparison, it would be much simpler to use esProc SPL. It has carefully designed a set of function library in the field of set operation, and the code is simple and easy to understand. For example, the above problem only needs two lines:


A

1

=Old=file("Old.txt").import@t(),New=file("New.txt").import@t()

2

=Old.(Name) ^ New.(Name)

In fact, there are many scenarios where it needs to parse and calculate text, even large file comparison, join calculation, importing into database and other requirements. It will be very simple to use esProc SPL directly, please refer toStructured Text Computing with esProc

esProc is also a professional tool for file data source processing. It can easily perform mixed calculation, importing into and exporting out of database of various file data, such as TXT, Excel, XML, JSON, CSV, ini, etc.

A desktop computing tool, esProc is ready to use, with simple configuration and complete debugging functions: breakpoints and single step execution can be set, and the result of each step can be viewed. The syntax is simple, in line with people's natural thinking, and simpler than other advanced development languages. Please refer to: http://www.raqsoft.com/html/file-processor.html

esProc is integration-friendly. Read How to Call an SPL Script in Java to see how we can easily embedded an SPL script into a Java program.

Read Getting Started with esProc to download and install esProc, get a license for free and find related documentation.