Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 10-12-2014, 10:42 AM   #1
LQ Newbie
Registered: Oct 2014
Posts: 1

Rep: Reputation: Disabled
Run soft command on multiple columns

I have been searching for hours and have not found an answer that works for me. I have a three column file that I want to sort each column separately. My code right now is:

sort -t $'\t' -k1,1n -k2,2n -k3,3n stuff > stuff.sort

I have tried with and without the K commands and no difference. I am trying to sort the following:

red beer owl
green vodka cat
blue whisky emu

Is this even possible to sort each column independently?

Thank you
Old 10-12-2014, 12:00 PM   #2
Senior Member
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,688

Rep: Reputation: 1259Reputation: 1259Reputation: 1259Reputation: 1259Reputation: 1259Reputation: 1259Reputation: 1259Reputation: 1259Reputation: 1259

Sort orders entire records from primary key to secondary to ...

If you want each column sorted independently of each other, you have to separate them into different files, then sort each and put the results back together.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
run single command on multiple systems sachin.davra Linux - Newbie 4 08-04-2014 04:24 AM
[SOLVED] Single command to run multiple commands on ssh knspradeep Linux - Enterprise 5 10-14-2013 07:40 AM
Run command on multiple server/node. hhh123 Linux - Server 3 11-25-2011 10:12 AM
sort by multiple columns wakatana Linux - Newbie 5 10-18-2009 03:35 PM
How to run multiple process in single command prompt babu198649 Linux - Newbie 7 10-12-2007 08:27 AM

All times are GMT -5. The time now is 11:09 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration