The sort tag has no wiki summary.
3
votes
2answers
718 views
Trying to sort on two fields, second then first
I am trying to sort on multiple columns. The results are not as expected.
Here's my data (people.txt):
Simon Strange 62
Pete Brown 37
Mark Brown 46
Stefan Heinz 52
Tony Bedford 50
John Strange 51
...
25
votes
8answers
4k views
how do you sort du output by size?
How do you sort du -sh /dir/* by size? I read one site that said use | sort -n but that's obviously not right. Here's an example that is wrong.
[~]# du -sh /var/* | sort -n
0 /var/mail
1.2M ...
7
votes
6answers
2k views
List files sorted numerically
I have a bunch of files from log1 to log164.
I'm trying to LIST the directory (sorted) in a UNIX terminal but the sort functions are only providing the format like this:
home:logs Home$ ls -1 | sort
...
3
votes
2answers
504 views
What's the default order of linux sort?
For a long period I think the default behavior of sort program is using ASCII. However, when I input the following lines into sort without any arguments:
#
@
I got:
@
#
But according to the ...
1
vote
3answers
94 views
Sort with unequal whitespace in first column
I need to sort this list by name, high temp and low temp:
Kuala Lumpur 78 56
Seoul 85 66
Karachi 95 75
Tokyo 85 60
Lahore 85 75
Manila 90 85
I figured since whitespace is the delimiter for a column ...
14
votes
5answers
3k views
sort but keep header line in the at the top?
I am getting output from a program that first produces one line that is a bunch of column headers, and then a bunch of lines of data. I want to cut various columns of this output and view it sorted ...
10
votes
5answers
2k views
case-insensitive search of duplicate file-names
I there a way to find all files in a directory with duplicate filenames, regardless of the casing (upper-case and/or lower-case)?
2
votes
6answers
2k views
Get text-file word occurrence count of all words & print output sorted
I had a command which would work through a text file, count all the occurrences of the words and print it out like this:
remy@box $˜ magic-command-i-forgot | with grep | and awk | sort ./textfile.txt
...
4
votes
1answer
514 views
Is there a search utility which can binary split search a large sorted (sequential) text file?
Yes, I know it sounds odd. Sequential and Binary-splits don't mix.. That is unless the sequence is the byte offset within the file itself...
I've scrambled together a binary split search in bash ...
3
votes
1answer
2k views
How to numerical sort by last column?
I have this input:
sdkxyosl 1
safkls 2
asdf--asdfasxy_asd 5
dkd8k jasd 29
sdi44sw 43
asasd afsdfs 10
rklyasd 4
I need this output:
sdi44sw 43
dkd8k jasd 29
asasd afsdfs 10
asdf--asdfasxy_asd 5
...
5
votes
2answers
108 views
Sort fields inline
I'm trying to sort within a line of input over an unknown number of fields:
Input:
ab bc
bc ab
cd ef bc
bc cd ef
cd bc ab
ef ab bc cd gh
Output:
ab bc
ab bc
bc cd ef
bc cd ef
ab cb cd
ab bc cd ...
5
votes
2answers
249 views
How would I sort these directory names numerically?
I'm aware that I can somehow sort this output numerically (so cpu1/ follows cpu0/) ... I could probably get something to work eventually by splitting up the string various ways with awk, but is there ...
4
votes
2answers
314 views
Sort behaves strangely on case sensitive sorting
Sort is sorting differently than I would expect. I have this file, call it text.txt:
a 1
A 1
a 11
(the space is always one \t)
I want to sort them alphabetically by the first column. ...
2
votes
2answers
683 views
Issues of using sort and comm
I was trying to find the intersection of two plain data files, and found from a previous post that it can be done through
comm -12 <(sort test1.list) < (sort test2.list)
It seems to me that ...
