Questions tagged [sorting]

Sorting is any process of arranging items according to a certain sequence or into different sets.

Filter by
Sorted by
Tagged with
271
votes
1answer
280k views

Sorting lines in Notepad++ without the TextFX plugin

The current version of Notepad++ (at the time of this writing) is 6.6.3. Version 6.5.2 is the first that introduced a native (without a plugin) sorting function. At least, that's what they claim; even ...
198
votes
18answers
248k views

Unix/Linux find and sort by date modified

How can I do a simple find which would order the results by most recently modified? Here is the current find I am using (I am doing a shell escape in PHP, so that is the reasoning for the variables): ...
103
votes
12answers
99k views

How to sort first directories then files etc… when using “ls” in Unix

I would like to use the ls command to first show directories and then files. I tried: ls -la | sort -k 1 But I got a wrong order.
55
votes
1answer
10k views

Case insensitive sorting

Vim's default sort is case sensitive, and produces results like this: A B a How can it be made case-insensitive, to produce the following result given the same input? A a B
52
votes
3answers
148k views

How to UNIX sort by one column only?

I know that the -k option for the Unix sort allow us to sort by a specific column and all of the following. For instance, given the input file: 2 3 2 2 1 2 2 1 1 1 Using sort -n -k 1, I get an ...
41
votes
7answers
51k views

In bash, how to sort strings with numbers in them?

If I have these files in a directory cwcch10.pdf cwcch11.pdf cwcch12.pdf cwcch13.pdf cwcch14.pdf cwcch15.pdf cwcch16.pdf cwcch17.pdf cwcch18.pdf cwcch1.pdf cwcch2.pdf cwcch3.pdf cwcch4.pdf cwcch5.pdf ...
39
votes
4answers
20k views

Equivalent of gnu `sort -R` on OSX?

The GNU sort text utility features a non-standard -R option to randomize input lines. OSX sort does not have this extension. Is there similar functionality available in another text filter?
37
votes
8answers
39k views

How do I get cells in Excel that contain IP addresses to sort properly?

I am currently working with a large list of IP addresses (thousands of them). However, when I sort the column containing the IP addresses, they don't sort in a way that is intuitive or easy to follow....
34
votes
1answer
5k views

Why does the `ls` command sort files like this?

As I was trying to reverse engineer the ls command, I came upon an interesting behavior. When I make 3 files, foo.png, foopa.png, and fooqa.png, ls sorts them as foopa.png, foo.png, and fooqa.png. I ...
32
votes
6answers
15k views

Why does 'sort' ignore special characters, like the asterisk?

I thought that sort would sort common prefixes together but that doesn't always happen. Take this input for example: AT0S*eightieths AT0S*eyetooth's AT*ad AT*Ad AT*AD AT*Eydie AT*eyed ATF*adv ATF*ATV ...
27
votes
5answers
13k views

Sort the contents of an extremely large (800GB) text file on Windows

I have a text file with a word in each line, the size of the file is 800GB. I need to sort the words alphabetically. I have tried using the Windows sort program using: sort.exe input.txt /o output....
25
votes
1answer
13k views

Sorting by Date - Very Slow

I'm using Windows 8 RTM. I have about 1,100 files in a folder. When I sort by date (in either direction), The address bar shows the green progress indicator as if it's working hard to perform the sort....
22
votes
1answer
64k views

How to sort an Excel spreadsheet columns by row contents?

How do I sort the columns of an Excel spreadsheet? The Sort command from the Data menu only allows me to sort rows by the value of a column. I want to sort the columns alphabetically by the contents ...
20
votes
6answers
81k views

How do I change the default sort order on Windows Explorer and the File Dialogs

My file dialog shows files sorted by date and I want it to sort alphabetically by filename.
19
votes
4answers
22k views

Is there a Windows equivalent to the Unix uniq?

I need remove duplicate lines from a text file, it is simple in Linux using cat file.txt |sort | uniq when file.txt contains aaa bbb aaa ccc It will output aaa bbb ccc Is there a Windows ...
19
votes
4answers
30k views

Sorting Excel column by IP address

I have a fairly large (over 200 row) Excel spreadsheet that lists items in my network (i.e. printers, servers, workstations, network projectors, etc), and one of the first columns is the IP Address ...
17
votes
8answers
16k views

Sorting human readable file sizes

How can I sort a list using a human-readable file-size sort, numerical sort that takes size identifier (G,M,K) into account? Can I sort "du -sh" output for example? Problem: Consider the problem of ...
16
votes
4answers
13k views

Windows 7, any way to sort folders and files all mixed together?

Is there a way to sort folders and files by their name all mixed together in Windows 7? It would be easier to understand if you look at this page. I want my folders and files arranged like the ...
15
votes
2answers
7k views

Sort --parallel isn't parallelizing

I'm trying to make unique a set of lines pulled from a file with egrep with sort -u, then count them. About 10% of the lines(all 100 characters long from the alphabet [ATCG]) are duplicated. There are ...
14
votes
2answers
42k views

How to sort by date modified ascending ALWAYS in Windows?

How to force Windows to sort always by date modified and always ascending? The situation is that often 1) Modified field is Off (not listed in Sort By menu by default) 2) Once opened More menu ...
14
votes
3answers
8k views

How to do custom sorting using unix sort?

I'm using unix sort to sort a comma delimited file with multiple columns. Thus far, this has worked perfectly for sorting the data either numerically or in alphabetical order: Example file before any ...
13
votes
5answers
18k views

Windows Explorer sorting order for special characters?

What is the sorting order used in Windows Explorer? I was specifically wondering what special characters sort after the alphabets? As far as I can tell (test), all special characters seem to be ...
12
votes
2answers
5k views

Sort by multiple columns in Windows Explorer 8

I have a directory, which contains many files (more than a thousand), from different types (file extensions). I can sort them by Date modified, or by Type. But seems that I can't sort them by both ...
12
votes
3answers
29k views

Alphanumeric sorting in Excel

In Excel, is it possible to sort alphanumerics from a-1, a-2, a-3...a-123 instead of a-1, a-10, a-100, a-11? Sorting via oldest to newest or via A-Z, definitely won't give me the result I want. I've ...
11
votes
4answers
34k views

Merging and sorting multiple files with “sort”

I have a bunch of text logfiles in the following format: ID (17 characters) Timestamp (14 characters YYYYmmddHHMMSS e.g. "20060210100040" -> 2006/02/10 10:00:40) Random data (? ...
11
votes
2answers
4k views

Sorting mail in Thunderbird by both unread status and by date

Is there any way to make Thunderbird sort mail so that unread mail is always at the top and the e-mails are sorted by date in descending order persistently? Maybe an add-on that someone can recommend? ...
10
votes
6answers
9k views

How to sort images into folders, based on resolution?

Background: I've got a folder full of saved desktop pictures. I'd like to put them into folders, based on their resolution - 1024x768, etc. Creating the folders on the fly is a bonus. Currently, the ...
10
votes
3answers
49k views

Fixing the first row as sortable title in Excel 2007

I know this is super easy, I just couldn't find it. I'd like the first row in an excel document to be the "title" field. I want that: Whenever I scroll down, this row will remain fixed I can sort ...
10
votes
2answers
3k views

ls version number sorting Mac OS X

Is there an equivalent to ls -v in Mac OS X that will do version number sorting? In Mac OS X, ls -v does NOT do version number sorting, but the Finder seems to.
10
votes
1answer
10k views

Sorting XML files so that differences can then be found

I need to compare two XML files, each of which is about 13,000 lines long. Sadly the code that generates these files doesn't generate the data in the same order each time (the data comes from a ...
9
votes
2answers
4k views

unix sort algorithm implementation

What sorting algorithm(s) is/are used in the unix sort command? Insertion/quicksort/etc.?
9
votes
3answers
15k views

Sort order in Windows Explorer

The behaviour described below occurs on Windows-7 systems and on Windows XP. We operate in a dual-language environment - English and Hebrew. When in Windows Explorer we sort files by name, the order ...
8
votes
4answers
16k views

Sorting numerically in a comma-delimited file with Unix

I've got a comma-separated file that looks like this: 100,00869184 6492,8361 1234,31 200,04071 I want to use sort to sort this file numerically by the first column only. Desired Result: 100,...
8
votes
3answers
22k views

fatsort for Windows 7 [closed]

I've used a program in Linux called fatsort to reorder the directories on my USB flash drive so that my car stereo navigates folders in alphabetical order instead of random order. Is there any ...
8
votes
1answer
4k views

Foobar2000 keeps playing the same set of songs even if the order is random

I use foobar2000 to listen to music but I kept hearing the same set of songs over and over again. My playlist has "Still Alive" and "Pure Pwnage" which it always plays even when there is other music ...
8
votes
2answers
3k views

Windows 7 Recycle Bin sort by Date Modified

In the Recycle Bin, I sorted by 'Date Modified', but the result is not in the proper order. It was neither ascending nor descending. Other sorts (by Date deleted, size, item type) all work well. Does ...
8
votes
2answers
5k views

How can I disable Windows Vista / 7 Explorer's “auto sort” after file copying?

One of the things that really annoys me in Windows Vista / Windows 7 is the new "auto sort" feature. In Windows XP, whenever you copy a bunch of files to a folder, they are all placed at the end of ...
7
votes
6answers
2k views

Joining text files with 600M+ lines

I have two files, huge.txt and small.txt. huge.txt has around 600M rows and it's 14 GB. Each line has four space separated words (tokens) and finally another space separated column with a number. ...
7
votes
11answers
171k views

Excel Sort Numeric Column By Number

I have a column of integers in my spreadsheet, and the column is formatted as a number. Each cell inside the column is formatted as a number. But I can't seem to sort them in numerical order - you ...
7
votes
2answers
1k views

In which order does Windows Explorer sort folders when sorting the results of the search by size?

The files are sorted by size but not the folders, so I wonder how Windows Explorer decides the ordering of folders when displaying them. I use Windows 7 SP1 x64 Ultimate. Example of sort by size:
7
votes
1answer
913 views

How to disable message sorting on Thunderbird?

I keep constantly clicking the "subject" sorting button, when I want to click on the newest message. How can I disable the sorting completely? Perhaps by hacking the .exe file? It's pretty much ...
7
votes
6answers
18k views

Outlook 2010 Unable to Categorize Messages

I am unable to categorize messages in my inbox. What I'm talking about is the ability to assign a color category. I'm accustomed to being able to just click the icon in the ribbon of the open message ...
7
votes
1answer
5k views

Sort lexicographically in bash

I want data to be sorted in the way Python sorts it, comparing ASCII values. But sort command seems too clever for that. Take a look. Since '.' < '9': $ sort . 9 ^D . 9 and : $ sort 1. 19 ^D 1. 19 ...
7
votes
3answers
9k views

Find all duplicate files by MD5 hash

I'm trying to find all duplicate files (based on MD5 hash) and ordered by file size. So far I have this: find . -type f -print0 | xargs -0 -I "{}" sh -c 'md5sum "{}" | cut -f1 -d " " | tr "\n" " "; ...
7
votes
1answer
3k views

How can I sort a folder in OS X Lion without having to group files as done with “Arrange By”?

I'm sorry to say there are several things I liked better in Snow Leopard. Sorting files in Finder is one of those things. If I "Arrange By" -> "None" it does not group items and it looks like 10.6. I ...
7
votes
2answers
1k views

In utf-8 collation, why 11- is less then 1-?

I found that the sort result in ASCII: Source file test: 1- 11- 1-a 11-a Sort using ASCII: $ LANG=en_US.ascii sort test 1- 1-a 11- 11-a And using UTF-8: $ LANG=en_US.utf8 sort test 1- 11- 11-...
7
votes
1answer
1k views

Disable ignoring of hyphen for sorting in Windows 10 File Explorer

In the Windows 10 File Explorer, the hyphen (and apostrophe?) characters are ignored for the purposes of sorting file or directory/folder names. For example: Does anybody know how to disable this ...
7
votes
1answer
1k views

How to sort Google Drive search results by title?

I find Google Drive very convenient as an online notebook to store my diary and records, that I can access anytime, anywhere. Now when I want to search for a particular string of text, the only ...
6
votes
2answers
12k views

How to sort ls by column in Ubuntu via piping to sort?

I'm a Linux newbie trying to learn how piping works in the Ubuntu terminal. I tried to sort by file size: ls -al | sort -k5 The files were listed in this order: drwx------ 19 min10 domain users ...
6
votes
1answer
519 views

List of files under a directory in name order

I wanted a list of files under a directory in name order to pass to an image viewer. I am using find $PHOTODIR -iname "*.jpg". Unfortunately this produces the images out of order. On a USB key (...

1
2 3 4 5
14