Visit Jeremy's Blog.
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, 11: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, 01:00 PM   #2
Senior Member
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,714

Rep: Reputation: 1280Reputation: 1280Reputation: 1280Reputation: 1280Reputation: 1280Reputation: 1280Reputation: 1280Reputation: 1280Reputation: 1280

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 05:24 AM
[SOLVED] Single command to run multiple commands on ssh knspradeep Linux - Enterprise 5 10-14-2013 08:40 AM
Run command on multiple server/node. hhh123 Linux - Server 3 11-25-2011 11:12 AM
sort by multiple columns wakatana Linux - Newbie 5 10-18-2009 04:35 PM
How to run multiple process in single command prompt babu198649 Linux - Newbie 7 10-12-2007 09:27 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:53 AM.

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