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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T21:30:11+00:00 2026-06-06T21:30:11+00:00

I have a reference file with only one column that goes like this: file1:

  • 0

I have a reference file with only one column that goes like this:

file1:
a
b
c
d
e

In a second csv file I have several column. In the first of these column there are some of the value present in the reference file:

file2:
a;34;42;23;45;1
c;3;2;1;7;8
e;6;2;2;1;3

What I would like to obtain is to add the lines that are present in file1 but not in file2 with constant value for some column and zero in the last column, so to have:

a;34;42;23;45;1
b;cost1;cost2;cost3;cost4;0
c;3;2;1;7;8
d;cost1;cost2;cost3;cost4;0
e;6;2;2;1;3

Any help?,

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-06-06T21:30:13+00:00Added an answer on June 6, 2026 at 9:30 pm
    ( cat file2  ; comm -23 file1 <(cut -d';' -f1 file2) \
    | sed 's/$/;cost1;cost2;cost3;cost4;0/' ) | sort
    

    to put it in the script copy the following text in it:

    ( cat file2  ; comm -23 file1 <(cut -d';' -f1 file2) | sed 's/$/;cost1;cost2;cost3;cost4;0/' ) | sort
    

    or even more adopted for human version:

    ( 
        cat file2
        comm -23 file1 <(cut -d';' -f1 file2) | sed 's/$/;cost1;cost2;cost3;cost4;0/' 
    ) | sort
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have a exrate.xml look like this <!--For reference only. Only one request every
I have a timer in my class that is I only ever want one
I have an application that fires several processes. Each process loads an HTML file
Is there a way to have the file reference work under ipad? The file
I have a javascript link that references another .js file. I've been trying to
I have a reference application that I use to work through DDD issues, and
I have a reference to call that may or may not be there. When
In C++ I have a reference to an object that wants to point back
I have this class that has a static member. it is also a base
OK, so I have a C++ project that compiles to a DLL file. I

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.