Questions tagged [sort]
Sorting text files or other data, for example with the sort utility.
1,029 questions
5votes
2answers
121views
How to show directory sizes in tree format with correct values and depth control
I can't solve what I want using the tree, du, or df commands. I'm using: du version 9.6 tree version 2.2.1 What I want: For the current directory, list all directories recursively to a depth of 3, ...
0votes
1answer
46views
Sort of different column using different types, works, only strange thing with spaces
I have this file 1 you 3 me 2 their 4 us this pipe works fine (it order first column by number, second by letters) is a pipe of another user found here paste <(awk '{print $1}' file.txt | sort ...
9votes
2answers
912views
How do I make `ls` sort the same way Thunar sorts files?
The title is a summary of what I'm trying to achieve, but I'll give an example to illustrate what my problem is and how I've been trying to solve it. Example folder Let's say I've got a folder on a ...
0votes
3answers
68views
Searching unique entries in a file
I am using Arch Linux/Debian Linux and want a list of unique "identifiers" in an ASCII txt file. Here is a snippet of the data I want to whittle down: ... (Received from VRW): wind ... ... (...
0votes
1answer
30views
How to sort correctly the processes hungry of ram?
With this cmd line I see processes and use of ram in mb ps aux | awk '{print $6/1024 " MB\t\t" $11}' | sort -rn|less The problem is the sort 9.95703 MB /usr/lib/systemd/systemd-...
3votes
1answer
83views
Why does command 'sort' behave differently for those 2 files
Those 2 sequences of lines are not sorted the same by the Linux shell command sort (gnu-coreutils 8.22 under RHEL 7.8), even though they begin with the same distinct prefixes. Why ? $ echo "f'*.5....
-5votes
1answer
59views
After wrote prompt $ sort [closed]
After I wrote prompt $ sort display doesn't shown anything what the next step?
1vote
1answer
88views
How can I find duplicate lines among files?
I have a software module which contains some files with same pattern. <whitespaces>private static final long serialVersionUID = \dL; How can I find files with the same value? $ grep -R ...
2votes
1answer
509views
linux sort float numbers starting with point
I would expect that the -g flag tells sort to treat the fields as floating point numbers, but: cat << EOF | sort -g -k1,2 0 0 0 1.0 0 .5 0 5.0 EOF gives 0 0 0 1.0 0 .5 0 5.0 Therefore the .5 ...
0votes
2answers
158views
Sort is not sorting?
I seem to be having the same issue as described in The "join" utility reports: file is not sorted, but in fact it is sorted however I have piped BOTH files through sort before attempting to ...
-2votes
2answers
138views
How to diff two files in bash efficiently?
I have two files containing the similar pattern: cmd1 [cmd2 {xx/xx[7] x/x[0] ...}] cmd3 [cmd4 {xx/x[12] ...}] cmd5 [cmd6 {x/x[1] xx ...}] I don't need to consider all the cmds in two files. Only need ...
10votes
3answers
2kviews
GNU sort command does not sort words of different lengths with common prefixes correctly when using field delimiter
The GNU sort command is not sorting words of different lengths with common prefixes correctly for me, but only when using a field delimiter to sort on one of multiple fields. Here is the correct, ...
0votes
0answers
10views
cat/sort/uniq temporary storage? [duplicate]
I'm wondering where this data is being stored. I am running these commands from a different file system, but / seems to increase and I'm not sure where the data is. cd /different_fs cat a b c | sort | ...
1vote
1answer
166views
Why is sorted uniq -c command showing duplicates
I am trying to count how many times I use a certain version of a library on my computer. For some reason, uniq -c is outputing duplicates, despite sorting it, and despite the sort order seeming in ...
-1votes
1answer
81views
Sorting Bash History for Redundancy Removal
I'm working with my .bash_history file and want to identify repetitive commands for cleanup. Here's a sample snippet: ... #1713251479 sh lowbat.sh #1713251495 nvim lowbat.sh #1713252186 sh lowbat.sh #...