Questions tagged [sort]

Sort is a command-line program that allows standard input or specified text files to be sorted in various ways such as numerically or alphabetically, and then the result can be displayed in the terminal or sent to file.

Filter by
Sorted by
Tagged with
0
votes
1answer
23 views

Reversed file is empty after piping

I have just started learning Linux and having problem with understanding piping. I am wondering why reversed.txt is empty? I want to save unsorted file first, then pass to reverse sort, then save to ...
2
votes
1answer
27 views

GNOME - Sort menu entries alphabetically

I wish I could arrange the GNOME application menu alphabetically, but I can't find anything about this online... Is there by any chance a gsettings option or a script to do this?
0
votes
1answer
105 views

How am I misusing sort?

I have a very small file bugtest.csv with years in the seventh column. Its contents read: 1000,101,1,2,"VEN","Venezuela, Bolivarian Republic of",1967,22,4,99,0,0,1967-12-07,"R/...
0
votes
0answers
32 views

du /home | sort -nr +0 -1 | head –10

I am a little confused with this command. Can someone please explain what the output of this command is? I see it in my terminal, but I do not understand what it is showing me.
0
votes
2answers
59 views

sorting a csv file with 3 columns

I am trying to sort a csv file containing 3 values. The first one is the one that matters. It contains many times the number 1, 2, 3, 4 etc etc. But each number doesnt appear the same number of times ...
0
votes
1answer
90 views

Make “Files” to sort, columns shown & order PERMANENT

Excuse me Please: How ought one force Ubuntu Kitty v20 "Files" to PERMANENTLY(never changing, always the same, nonvolatile) Sort in a specific way, and PERMANENTLY display certain Columns ...
4
votes
1answer
243 views

How to set memory usage sort in top command as default?

I want to sort the memory usage in top command as default. So that i do not have to sort in every i run top command. How to do that? Thanks in advance....
2
votes
1answer
30 views

How to invert sorting arrows? Aka sorting arrows are wrong

In a table, I feel the sort indicator symbol is wrong. I want: ▲ = ASC ▼ = DESC (or maybe even the other way around - depending on your needs)
0
votes
0answers
42 views

Need help with sort -nr

I run this code in Jupyter and it runs well without command sort -nr. I know it is not incorrect but I don't know how to fix this. I would like to have the top n lines after the sort but I got stuck ...
0
votes
1answer
87 views

Sorting and moving a directory with files into subdirectories

Im using Linux Mint 19.3 Cinnamon, based on Ubuntu 18.04. (I hope Im not 'cursing in church' by that info .. ! But its functionally the same as Ubuntu 18.04 to 95%). Trying to move files in a folder ...
2
votes
1answer
47 views

How to display the 10 most recent started processes

I am trying to pipe the output of ps -ax -o pid,lstart into an awk and work with that or try to sort by a certain collumn using sort , but the output of ps -ax -o pid,lstart is something like 1 ...
0
votes
0answers
12 views

how to sort polytonic grec words ? “LC_COLLATE=el_GR sort” does not do the job

I want to sort polytonic words, that is sorting in such a way that diacritic symbols are ignored : that means, for example, that words beginning by the character ἀ (U+1F00 GREEK SMALL LETTER ALPHA ...
0
votes
1answer
96 views

List unique result only on history command

I ran this command history | cut -c 8- It listed all the history commands as expected without line numbers. I'm wondering if there is a way to list only unique one. I've tried history | cut -...
1
vote
0answers
31 views

Music Library Sorting

I've tried a few different music players and they all seem to lack the one feature I want. It's possible they all have it and I just don't know how to use it, too. I've got a collection that's only ...
3
votes
2answers
397 views

How do I preserve the line ordering for two “equal” strings while sorting and ignoring the case?

The contents of fred is: START test TEST tEST END From the bash terminal, sort fred returns: END START test tEST TEST All good. Now I type sort fred -f with the same result for sort fred. But ...
1
vote
2answers
406 views

sort is very slow for big files

I want to sort file (with removing duplicates) which contains wordlist with a size of almost 25GB. I am using sort command in Ubuntu terminal but it takes hours to output sorted file, the command is: ...
0
votes
2answers
53 views

Getting the biggest partition on server

I'm trying to get the biggest partition out of "df -h" into a variable without success. Filesystem Size Used Avail Use% Mounted on udev 462M 0 462M 0% /dev tmpfs ...
2
votes
1answer
51 views

Directories aren't on the beginning of the view in Nautilus file manager, how to change this?

I am on Ubuntu 19.04. I have probably clicked some shortcut which changed directory view in Nautilus (Files application) and for a few days all directories are sorted like on the screenshot. I can't ...
0
votes
5answers
82 views

Sorting each column and getting their corresponding key IDs in the first row for the bottom 2 values

This is my working file. (Column number and Row number are not known) key_ID col_1 col_2 col_3 AA 1 1 1 BB 56 2 7 CC 89 5 2 DD 7 77 7 I want to sort ...
0
votes
0answers
614 views

How to sort the file in such a way that join command accepts the sorted file?

I sorted two files and used join to merge the columns of the files according to row names. Commands I used sort file 1 > file1_sort sort file 2 > file2_sort join -o auto -e '0' -...
1
vote
1answer
251 views

How do I sort a file based on both letters and numbers?

A file with this content: abc[0] abc[100] abc[101] . . abc[127] abc[19] abc[1] . . abc[9] xyz[0] xyz[100] xyz[101] . . xyz[127] xyz[19] xyz[1] . . xyz[9] I want to retain the ...
0
votes
2answers
119 views

How to sort file after text-me-not/ in Unix and ignore case?

I have this data and want to sort it alphabetically after the string test-me-not/ and ignore case. hello-yourself/www/test-me-not/watermelon-green hello-yourself/www/test-me-not/orange-orange hello-...
1
vote
2answers
91 views

extract the oldest values from a master file per each code

I need help writing a script that would extract from a master file the oldest records and save them in a separate file. The file contains hundreds of ISIN codes and additional data. For each, there ...
19
votes
8answers
3k views

How to count occurrences of text in a file?

I have a log file sorted by IP addresses, I want to find the number of occurrences of each unique IP address. How can I do this with bash? Possibly listing the number of occurrences next to an ip, ...
-1
votes
2answers
58 views

Sort ps result but with the first row instantly unchanged

I want to sort all the processes by Memory me@host:~$ ps au | sort -r -k 5 | head -10 | sed "s/$USER/me/g" USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND me 2312 0.0 0....
0
votes
2answers
69 views

using sort command while strings in first column repeats

I have a data file as follows; ALIC 5.55 2.65 3.45 ALIC 2.56 2.78 3.99 AMC4 3.55 3.66 4.88 AMC4 3.00 3.67 4.78 ALIC 1.00 1.00 1.00 ALIC 0.95 1.00 1.00 AMC4 0.50 1.00 1.00 AMC4 0.01 1.00 1.00 I need ...
1
vote
1answer
637 views

How do I tell grep after piping from cat to only highlight numerals greater than 720, or perhaps, more than two digtis?

It's a fairly simple question. If you would like to include additionally useful information about using grep in this manner, feel free.
0
votes
2answers
45 views

How can I sort a text file from number of occupied lines?

How could I sort a text files from number of ocupied lines? From: `He spoke to her, saying, "Dear child, can my servant and I find shelter for the night in this little house?" "Oh, yes," said the ...
13
votes
3answers
2k views

How to sort search-results in Nautilus?

After upgrading to 18.04, I find that the File Manager will not allow sorting (date, type, name etc) after a search. It does allow sorts prior to a search. This change is not an improvement.
4
votes
3answers
2k views

Sorting values and grepping the best score (highest number)

I have a file that looks like this: 7 C00000002 score: -41.156 nathvy = 49 nconfs = 2251 8 C00000002 score: -39.520 nathvy = 49 nconfs = 3129 9 C00000004 score: -...
1
vote
1answer
171 views

How can I sort fonts of different languages?

Is it possible to sort fonts of different languages instead of the alphabetical order which is the default sorting order?
6
votes
2answers
538 views

Creating a complete and alphabetically sorted .txt file of bash history

I want to have a complete and sorted list of my bash history. But there are some problems: By doing history the list never shows the complete list and only 1000 commands are shown. In my $HOME ...
2
votes
1answer
42 views

Extract number if lines from file in order of date file name

I have a folder with csv files whose file names are dates, viz.: January-01-2018.csv, January-02-2018.csv, ..., April-30-2018.csv. Using Bash preferably, I want to extract the number of lines from ...
0
votes
1answer
106 views

Run sort command in terminal

I have this file: root:x:0:0:root:/root:/bin/bash bin:x:1:1:bin:/bin:/sbin/nologin daemon:x:2:2:daemon:/sbin:/sbin/nologin adm:x:3:4:adm:/var/adm:/sbin/nologin nickson:x:999:504:instructor:/home/SI/...
3
votes
0answers
1k views

How to sort files files alphabetically rather than numerically in file manager

With "ls" the following files are sorted as I want as: 026 046 048 08f 28f 46a but in file manager (I have tried nautilus, nemo and pcmanfm) they are sorted as: 08f 026 28f 046 46a 048 ...
1
vote
2answers
48 views

Visualize sorted storage volume use [duplicate]

My desktop storage capacity reaches its limit. How can I visualize my storage partition between files and apps (Android-like) to efficiently dig into the heaviest files?
1
vote
1answer
686 views

How can I use the “sort” command on a specific field?

In the below example (the original file is much bigger), how can I sort the lines w.r.t. line number of /185/ and /215/? /home/sorbilene/GAMIT_PROCESS/displacement/2/185/gsoln/res_2017-185_2017-186/...
0
votes
1answer
92 views

Wrong behaviour of “sort -u”?

[updated 12.11] I found a temporary solution for this. LC_ALL=C sort -u from bugreport here sort will get info from LC_ALL or LANG, My default is empty for LC_ALL, but zh_CN.UTF-8 for LANG. If ...
0
votes
1answer
35 views

Sort only rows in a file [duplicate]

I want to sort only rows in my file e.g 5 2 2 1 and I want to have an output like this 2 5 1 2 Could someone help me ?
-6
votes
4answers
142 views

Wrong sorting a text file

I have this simple text file and want to sort all lines by the response_time column: 1 console-2017_09_17.log:2017-09-17 00:04:02,507:INFO :pool-8982-thread-30:r.a.u.j.PerfRequestInterceptor - method=...
2
votes
3answers
685 views

Insert a character in a filename, depending on filename length [closed]

I've got about 18k of files which are named this way: 0001_6548 0002_7674 ... 14767_4536 I need to add a leading zero to filenames that contain only 4 digits in the first part, so they naturally ...
2
votes
1answer
1k views

Which LINUX command to be used for 'cut and replace a column' task?

http://paste.ubuntu.com/24184546/ This is the file. Here, I need to replace the 6th column with numbers from 1 to 158 respectively. The output should be like, http://paste.ubuntu.com/24184581/ How ...
-2
votes
2answers
126 views

Sort items in a folder according to given order

Suppose I have a file a.txt in which every line contains the line number (starting from 1) followed by a space and then followed by a name (the name of an item in a folder like e.g - something.mkv). I ...
4
votes
1answer
1k views

Sort command not working as intended on numbers

Here's my list.txt: a 100 b 300 A 50 e 75 1 10 I ran the command below: sort -k2,2 list.txt This is what I got: 1 10 a 100 b 300 A 50 e 75 I am trying to only sort ...
7
votes
3answers
7k views

How do I sort folders by actual size, instead of amount of sub-folders or files

I am pretty new with Ubuntu, so take it easy on me. This is the "problem" (feature?) that I'm experiencing. It sorts by amount of folders and files, not by the actual file size. I want to know much ...
3
votes
2answers
135 views

Sort files on nth character of name in a filemanager?

I would like to sort directories of files by a specified position in the filename using a "graphical" filemanager. I have loads of files of this type (e.g.): 0001_oeirnglhk.ext 0002_gkggkcxiuv.ext ...
0
votes
1answer
1k views

How to sort a file with bash

I have a file with one word on each line and I want to sort the file alphabetically. There's 2050 words in the file, so doing it manually would take a long time. Is there a bash script to sort it ...
2
votes
2answers
1k views

Sort from terminal is not working properly

I am trying to sort a text file by its second column. All the text in the file is in word /t number format (a word, tab, and it's weight). I am trying to sort the file by it's second column, by weight ...
1
vote
1answer
1k views

How does uniq work? [duplicate]

Do not confuse this question to be a duplicate of "what is difference b/w sort -u and sort | uniq" This is in essence a word count program Confusion raised from the following command is reason for ...
2
votes
1answer
166 views

Sort files into subfolders acoording to name [script]

I have several files which were recovered from a backup but have the structure (file location) as the file name. eg: C\Users\Welcome\Desktop\Doc1.docx F\New folder\concerts\0904M002.WAV I want to ...