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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T09:05:15+00:00 2026-05-29T09:05:15+00:00

Is there a simple unix command set I can use to separate two lists

  • 0

Is there a simple unix command set I can use to separate two lists into three lists that are comprised of the common lines between the two lists, the lines unique to the first, and the lines unique to the last? The lists would be unsorted and each line would be unique.

For example:
List 1:
cat
hat
box

List 2:
box
dog
rock

Output: box, cat hat, dog rock

  • 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-29T09:05:15+00:00Added an answer on May 29, 2026 at 9:05 am
    cat file1
    box
    cat
    hat
    
    cat file2
    box
    dog 
    rock
    
    comm file1 file
                  box
    cat
       dog
    hat
       rock
    

    The output is column based, with column being data only in 1st file, 2nd column being data only in 2nd file, and 3rd column is values common to both.

    Note that data is sorted.

    If you’re using bash, you can do things like

     comm <(sort file1) <(sort file2)
    

    to temporarly sort the files.

    by using args to comm like -1 -2 you can supress the output of column 1 and 2, and of course -3 by itself would elimate the 3rd column (words in common), leaving just the words not common.

    I hope this helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two simple programs set up that share data through a unix domain
I have two lists of IP addresses. I need to merge them into three
Are there simple libraries out there (.NET and Java) that are able to validate
There is simple cipher that translates number to series of . ( ) In
Is there a simple way to cache MySQL queries in PHP or failing that,
I know there are some unix utils for simple architecture queries: arch nproc lsb_release
I am creating a simple Unix server written in C++ that simply waits for
I have a Python-based app that can accept a few commands in a simple
I'm looking for a Unix command that will allow me to search/replace in a
Is there a way in unix/linux to execute a command when you cd to

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.