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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T00:36:09+00:00 2026-06-05T00:36:09+00:00

input.txt 1,Ram,Fail 2,John,Fail 3,Ron,Success param.txt (New Input) 1,Sam,Success 2,John,Sucess Now i want to replace

  • 0

input.txt

1,Ram,Fail
2,John,Fail
3,Ron,Success

param.txt (New Input)

1,Sam,Success
2,John,Sucess

Now i want to replace the whole line in input.txt with those present in param.txt .
1st column will act like a primary key.

Output.txt

1,Sam,Success
2,John,Sucess
3,Ron,Success

I tried as

awk 'FNR==NR{a[$1]=$2 FS $3;next}{ print $0, a[$1]}' input.txt param.txt > Output.txt 

But it is merging the file contents.

  • 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-05T00:36:11+00:00Added an answer on June 5, 2026 at 12:36 am

    This might work for you (GNU sed):

     sed 's|^\([^,]*,\).*|/^\1/c\\&|' param.txt | sed -f - input.txt
    

    Explanation:

    • Convert param.txt into a sed script using the first field as an address to change the line in the input.txt. s|^\([^,]*,\).*|/^\1/c\\&|
    • Run the script against the input.txt. sed -f - input.txt
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my file input.txt, I want to replace A->B, B->C, and C->A i.e. I
Sorry for asking very simple question.I'm new to coding. Input txt file 5,3 001
I have a list of files [input1.txt,input2.txt,input3.txt] I want to create a new file
My code looks like this: a = IO.readlines(input.txt).map { |line| Vector.[](line.split) } Now I
#!/bin/bash ./program < input.txt > output.txt The > output.txt part is being ignored so
I'm doing some analysis something like this: library(plyr) input.files <- c(file1.txt, file2.txt, file3.txt) input.data
My input file is a large txt file with concatenated texts I got from
When I input locations from a txt file I am getting a peculiar error
I have the following: C:\temp\dowork.exe < input.txt processing....... complete C:\ I try this: processArguments
I have two files listed in input.txt, I can read in the first one

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.