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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T18:48:38+00:00 2026-06-09T18:48:38+00:00

I have a csv file with fields delimited by ;. There are 8 fields,

  • 0

I have a csv file with fields delimited by “;”. There are 8 fields, and I want to sort my data by the first 4 columns, in increasing order (first sort by column 1, then column 2, etc)

How I can do this from a command line in linux?

I tried with open office, but it only lets me select 3 columns.

EDIT: among the fields on which I want to sort my data, three fields contain strings with numerical values, one only strings. How can I specify this with the sort command?

  • 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-09T18:48:39+00:00Added an answer on June 9, 2026 at 6:48 pm

    Try:

    sort -t\; -k 1,1n -k 2,2n -k 3,3n -k 4,4n test.txt
    

    eg:

    1;2;100;4
    1;2;3;4
    10;1;2;3
    9;1;2;3
    
    > sort -t\; -k 1,1n -k 2,2n -k 3,3n -k 4,4n temp3
    1;2;3;4
    1;2;100;4
    9;1;2;3
    10;1;2;3
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a csv file with 7 fields of data. I want to sort
I have .csv file that contain 2 columns delimited with , . file.csv word1,word2
I have a CSV-file delimited by colons, but it contains text-fields wrapped in quotes,
I have a csv file with first line as fields and remaining lines as
I have a csv file where amount and quantity fields are present in each
I have a CSV file that I'm working with, and all the fields are
I have CSV file and Macro in VBA. I want to open CSV file
Background - I want to extract specific columns from a csv file. The csv
I want to combine combine fields from an input .csv file for output to
I have a CSV file in the following format: id,code,date,address,complete_url Example data from the

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.