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 6667071
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T02:53:41+00:00 2026-05-26T02:53:41+00:00

I am trying to join 2 files together – both files are in CSV

  • 0

I am trying to join 2 files together – both files are in CSV format – both files have the same columns. Here is an example of each file :

File 1:

CustName,AccountReference,InvoiceDate,InvoiceRefID,TelNo,Rental,GPRS,Mnet,MnetPlus,SMS,CSD,IntRoaming,NetAmount
acme,107309   ,2011-09-24 12:47:11.000,AP/157371,07741992165     ,2.3900,.0000,.0000,.0000,.0000,.0000,.0000,2.3900
acme,107309   ,2011-09-24 12:58:32.000,AP/162874,07740992165     ,2.0000,.0000,.0000,.0000,.0000,.0000,.0000,2.0000
anot,107308   ,2011-09-24 12:58:32.000,AP/162874,07824912428     ,2.0000,.0000,.0000,.0000,.0000,.0000,.0000,2.0000
anot,107308   ,2011-09-24 12:47:11.000,AP/157371,07834919928     ,1.5500,.0000,.0000,.0000,.0000,.0000,.0000,1.5500

File 2:

CustName,AccountReference,InvoiceDate,InvoiceRefID,TelNo,Rental,GPRS,Mnet,MnetPlus,SMS,CSD,IntRoaming,NetAmount
acme,100046,2011-10-05 08:29:19,AB/020152,07824352342,12.77,0.00,0.00,0.00,0.00,0.00,0.00,12.77
anbe,100046,2011-10-05 08:29:19,AB/020152,07741992165,2.50,0.00,0.00,0.00,0.00,0.00,0.00,2.50
acve,100046,2011-10-05 08:29:19,AB/020152,07740992165,10.00,0.00,0.00,0.00,0.00,0.00,0.00,10.00
asce,100046,2011-10-05 08:29:19,AB/020152,07771335702,2.50,0.00,0.00,0.00,0.00,0.00,0.00,2.50

I would like to join the 2 files together – but just taking some of the columns the other columns can be ignored (some are the same, some are different) –

AccountRef,telno, rental_file1,rental_file2,gprs_file1,gprs_file2 etc etc ….

The join should be done on the telno column (it seems I have white space in file 1 – hope that can be ignored ?

i have found lots of examples using JOIN but all of them use the first column for the key on the join …. any pointers would be great – thanks

  • 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-26T02:53:42+00:00Added an answer on May 26, 2026 at 2:53 am
    awk -F' *, *' 'NR > 1 && NR == FNR {
      _[$5] = $0; next
      }  
    NR == 1 {
      print "AccountReference", "TelNo", "Rental_" ARGV[2], \
      "Rental_" ARGV[3], "GPRS_" ARGV[2], "GPRS_" ARGV[3]
      next
      }
    $5 in _ {
      split(_[$5], t)
      print $2, $5, $6, t[6], $7, t[7]
      }' OFS=, file2 file1  
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to join together several audio files into one mp4/m4a file containing
I'm trying to join two associative arrays together based on an entry_id key. Both
I am trying to modify the example http://www.html5rocks.com/en/tutorials/file/dndfiles/#toc-reading-files to make function handleFileSelect(evt) return reader.result;
I'm trying to join two files each of which contains rows of the form
Here's what I am trying to accomplish - I have about a million files
I'm trying to join the same table in sqlalchemy. This is a minimial version
I have a 3 tables that I'm trying to join and get distinct results.
I'm trying to do an Outer Join in Symfony. Here's the bit of code
I am trying to scan my harddrive for jpg and mp3 files. I have
I am trying to join a number of binary files that were split during

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.