Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Compare 2 files
#1
What is the Script in Python to
Print Field = 2 of "File1.txt" and Field = 4 of "File2.txt"
When Field = 1 is "A4" of "File1.txt" is equal Field = 1 is "A4" of "File2.txt"

File 1

| A1| A| Ab| Abc| ABCD| ABCDE| ABCDEF|
| A2| Ab| Abc| ABCD| ABCDE| ABCDEF|
| A3| Abc| ABCD| ABCDE| ABCDEF|
| A4| ABCD| ABCDE| ABCDEF|

File 2

| A1| A| Ab| Abc| ABCD| ABCDE| ABCDEF|
| A2| A| Ab| Abc| ABCD| ABCDE| ABCDEF|
| A3| A| Ab| Abc| ABCD| ABCDE| ABCDEF|
| A4| A| Ab| Abc| ABCD| ABCDE| ABCDEF|

Answer - ABCD (File 1) and ABCD (File 2)
Reply


Messages In This Thread
Compare 2 files - by tslavov - Feb-10-2023, 02:44 PM
RE: Compare 2 files - by Larz60+ - Feb-10-2023, 06:27 PM
RE: Compare 2 files - by ibreeden - Feb-12-2023, 10:53 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Compare folder A and subfolder B and display files that are in folder A but not in su Melcu54 3 618 Jan-05-2024, 05:16 PM
Last Post: Pedroski55
  Compare fields from two csv files georgebijum 3 1,430 Apr-25-2022, 11:16 PM
Last Post: Pedroski55
  Compare filename with folder name and copy matching files into a particular folder shantanu97 2 4,575 Dec-18-2021, 09:32 PM
Last Post: Larz60+
  How can I compare Python XML-Files and add missing values from one to another kirat 2 2,740 Aug-30-2019, 12:17 PM
Last Post: perfringo
  Compare two large CSV files for a match Python_Newbie9 3 5,852 Apr-22-2019, 08:49 PM
Last Post: ichabod801
  Keyword compare in two files and output the results kotigasp 2 2,862 Jan-23-2018, 08:13 AM
Last Post: buran

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020