Questions tagged [sort]
Sorting text files or other data, for example with the sort utility.
1,029 questions
5
votes
2
answers
120
views
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, ...
0
votes
1
answer
46
views
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 ...
9
votes
2
answers
912
views
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 ...
0
votes
3
answers
68
views
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 ...
... (...
0
votes
1
answer
30
views
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-...
3
votes
1
answer
82
views
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....
-5
votes
1
answer
59
views
After wrote prompt $ sort [closed]
After I wrote prompt $ sort
display doesn't shown anything what the next step?
1
vote
1
answer
88
views
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 ...
2
votes
1
answer
509
views
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 ...
0
votes
2
answers
158
views
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 ...
-2
votes
2
answers
138
views
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 ...
10
votes
3
answers
2k
views
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, ...
0
votes
0
answers
10
views
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 | ...
1
vote
1
answer
166
views
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 ...
-1
votes
1
answer
81
views
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
#...