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

  • SEARCH
  • Home
  • 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 8523229
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T07:21:02+00:00 2026-06-11T07:21:02+00:00

Input File 1 A1 123 AA B1 123 BB C2 44 CC1 D1 12

  • 0

Input File 1

A1  123 AA
B1  123 BB
C2  44  CC1
D1  12  DD1
E1  11  EE1

Input File 2

A   sad21   1
DD1 124f2   2
CC  123tges 3
BB  124sdf  4
AA  1asrf   5

Output File

A1  123 AA  1asrf   5
B1  123 BB  124sdf  4
D1  12  DD1 124f2   2

Making of Output file

We check 3rd column of Input File 1 and 1st Col of Input File 2.

If they match , we print it in Output file.

Note :

The files are not sorted

I tried :

join -t, A B | awk -F "\t"  'BEGIN{OFS="\t"} {if ($3==$4) print $1,$2,$3,$4,$6}'

But this doesnot work as files are unsorted. so the condition ($3==$4) won’t work all the time. Please help .

  • 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-06-11T07:21:04+00:00Added an answer on June 11, 2026 at 7:21 am
    perl -F'/\t/' -anle 'BEGIN{$f=1}if($f==1){$H{$F[2]}=$_;$f++ if eof}else{$l=$H{$F[0]};print join("\t",$l,@F[1..$#F]) if defined$l}' f1.txt f2.txt
    

    or shorter

    perl -F'/\t/' -anle'$f?($l=$H{$F[0]})&&print(join"\t",$l,@F[1..$#F]):($H{$F[2]}=$_);eof&&$f++' f1.txt f2.txt
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am stuck here: my input file: 123 456 789 872 727 282 123
I've got a file INPUT that has the following contents: 123\n 456\n 789 I
I have a <input type=file id=uploadPicture value=123> When I'm using: alert($(#uploadPicture).val()); It alerts an
My input file's contents are: welcome welcome1 welcome2 My script is: for groupline in
My input file is a large txt file with concatenated texts I got from
Say my input file is tab delimited, how do i identify if $0 contains
My raw input file text file contains a string: Caf&eacute (Should be Café) The
If I have an input file like: US, P1, AgriZone, H, 1000, 1200, 1101,
I am styling an Input File type using only CSS, and it works on
This is one line of the input file: FOO BAR 0.40 0.20 0.40 0.50

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.