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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T04:53:30+00:00 2026-06-01T04:53:30+00:00

if a file contains multiple columns, seperated by comma, like this: aaa,1,4,4,5,7 bbb,1,4,9,1,2 Is

  • 0

if a file contains multiple columns, seperated by comma, like this:

aaa,1,4,4,5,7
bbb,1,4,9,1,2

Is there difference between ‘sort -t, -k1 file.txt’ and ‘sort -t, -k1,1 file.txt’?
though with the example above, there is no difference, but in some of my project case, it
does has difference, but the difference is reflected in the case that I use the sorted file to join, and the join command throws out exception that ‘join: file 2 is not in sorted order’ (at that time , I use ‘sort -t, -k1 file.txt’) . Later I use ‘sort -t, -k1,1 file.txt’, and join command works well then. Can anybody tell me why?

  • 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-01T04:53:32+00:00Added an answer on June 1, 2026 at 4:53 am

    sort -k1 means sort starting on key 1 till the end of the line. sort -k1,1 means sort from key 1 to key 1 (so only the first key). On my machine, the two make a difference if I specify stable sort with -s:

    ~ $ cat test.txt
    aaa,1,4,4,5,7
    aaa,1,3,9,1,2
    
    ~ $ sort -t, -k1 -s test.txt
    aaa,1,3,9,1,2
    aaa,1,4,4,5,7
    
    ~ $ sort -t, -k1,1 -s test.txt
    aaa,1,4,4,5,7
    aaa,1,3,9,1,2
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For example, a file contains multiple strings, where some look like this: --EX ABCDEFG
I have a file which contains multiple lines of this format: Item A 62.7
I have a string that contains multiple parameters delimited by #, like this :
I have a single file that contains multiple concatenated XML files like so: <?xml
Updated According to comments: I have outlog.txt file which contains multiple filenames, e.g: 2345_535_Dell&HP_3PAR_DEAL.txt
i am trying to read a text file, say file.txt and it contains multiple
I tried to transform an xml input file that contains multiple identical elements into
tmp-file contains: database_1 database_2 database_3 I want to run a command like mysqldump DATABASE
Basically what I want to do it this: a pdb file contains a location
I've got a CSV file that contains multiple data chunkds: Alice Age,Weight,Height 20y,50kg,170cm Bob

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.