Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6067373
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T09:36:04+00:00 2026-05-23T09:36:04+00:00

I want to automate a process that I do manually right now. I currently

  • 0

I want to automate a process that I do manually right now. I currently compare two .txt documents (we will call them “D1” and “D2”) and create a third (call it “D3”) that is a combination of the other two. What I need to do is find a certain string in “D1” and find a similar/same string in “D2”. Once there is a match, I need to replace the string in “D1” with the following string that matched “D2” and put it in “D3” as a master file. This sounds a bit confusing so here is what I would like it to look like:

The .txt file format for “D1” is as follows:

    1       0010  12345              DEF, DEF-0320            
    1       0020  ABC-00010G         ABC-A,1xx,10%,x1x,0603   
    1       0020A ABC-00010G         ABC-A,1xx,10%,x1x,0603   
    1       0030A ABC-00127G         ABC,4.7xx,10%,x1x,0805  

The .txt file format for “D2” is as follows:

    10 BARE PCB
    20 T C40, C3112
    B C5, C45, C48
    30 B C25

I want to compare both “D1” and “D2” and find the values ‘0010’, ‘0020’, ‘0020A’, ‘0030A’ from “D1” and the values ’10’, ’20’, ’30’ from “D2”. If (when) there is a match between the two sets of numbers (ie, ‘0010’ and ’10’) I would like to format a new document, “D3”, as follows:

    1       AAAA BCD  142717             DEF, DEF-0320                 T
    1       C40       ABC-00010G         ABC-A,1xx,10%,x1x,0603        T
    1       C3112     ABC-00010G         ABC-A,1xx,10%,x1x,0603        T
    1       C5        ABC-00010G         ABC-A,1xx,20%,x1x,0603        B
    1       C45       ABC-00010G         ABC-A,1xx,20%,x1x,0603        B
    1       C48       ABC-00010G         ABC-A,1xx,20%,x1x,0603        B
    1       C25       ABC-00127G         ABC,4.7xx,100%,x1x,0805       B

The ‘T/B’ is assigned based on whether or not there is an ‘A’ following the second number in “D1”. ‘T’ is assigned if there is just a number, ‘B’ is assigned if there is an ‘A’. Also, there are more lines in the “D3” .txt document because of the ‘,’ seperating the different values (ie, for ’20’, there is ‘C40’ and ‘C3112’). For every ‘,’ in “D2” there needs to be a new line in “D3” that has the same following format as the line above it.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T09:36:04+00:00Added an answer on May 23, 2026 at 9:36 am

    Colton wrote

    So my question is, what is the best way to go about reading “D1” and “D2” and comparing the two for similar strings and than proceeding to replace the text in “D1”?

    Here’s a way (there is no best way, at least not one where everyone agrees with one another):

    1. read both files line by line [?]
    2. split each line on their white spaces [?]
    3. for both files, create a 2 dimensional array [?]
    4. compare the appropriate columns from your 2 dimensional arrays to each other and check if one contains the other [?]
    5. write something back to a 3rd file [?]
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to create an application that will automate a very specific build process
I want to Automate the build process of my company. We are Using.Net platform
I want to automate a Windows 2000+ server reboot process using Task Scheduler or
I'm working on a process that will perform natural language processing (NLP) on one--and
I want to automate process of string localization. Translations are stored in database. The
I want to automate the build process for my C# solutions. How can I
The problem is following: I want to automate the way my emacs starts. It
I have a vendor supplied MSI file, and we want to automate the install
I want to create an Action to automate GCJ compilation. Since I couldn't make
Assuming I'm trying to automate the installation of something on windows and I want

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.