Skip to main content

Questions tagged [sort]

Sorting text files or other data, for example with the sort utility.

Filter by
Sorted by
Tagged with
4 votes
1 answer
180 views

Suppose we have a script named test_sort in our $PATH with the following contents: #!/bin/bash function echo_text () { printf -- "%s\n" "$fc$oc$fs$lc" printf -- "%s\n&...
Melab's user avatar
  • 4,478
5 votes
0 answers
141 views

In Nautilus (Debian 12, en_US.UTF-8, GNOME Files 43.2), the following eight files are sorted in the following order: - -1 -- --1 1 --a -a a To answer the question (Why does Nautilus sort these files ...
user769759's user avatar
4 votes
2 answers
609 views

Here is my simple test file: # cat test grp_pt cmg grp_pt compsc grp_pt ffre grp_pt grp_pt grp_pt hpcedt grp_ptix dsnlp grp_ptix exinspect grp_ptix ptix grp_ptix sciml grp_ptix vers grp_ptix ...
Thu-Ha Tran's user avatar
3 votes
1 answer
255 views

I have a file named test with the following content: 12288 4096 505 Note that there's a single space before 12288, two spaces before 4096 and three spaces before 505. When I run GNU sort -k1.1,...
russell.price's user avatar
0 votes
1 answer
55 views

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 ...
elbarna's user avatar
  • 14.3k
0 votes
3 answers
133 views

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 ... ... (...
Zac Helmberger's user avatar
4 votes
1 answer
119 views

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....
Francois's user avatar
  • 247
1 vote
1 answer
116 views

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 ...
Jin Kwon's user avatar
  • 564
0 votes
2 answers
259 views

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 ...
symcbean's user avatar
  • 6,359
10 votes
3 answers
2k views

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, ...
Ben McIlwain's user avatar
1 vote
1 answer
196 views

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 ...
Albert's user avatar
  • 171
1 vote
3 answers
856 views

I want to loop over all files in directory on macOS and perform some operations on each file, and do this based on their size, going from big to small. To create a list I can loop over I do this: ...
d-b's user avatar
  • 2,077
6 votes
2 answers
1k views

I'm tracking the configuration of some system in JSON format in a revision control system. Unfortunately that configuration is retrieved using some closed-source proprietary command, and the output ...
Stéphane Chazelas's user avatar
3 votes
1 answer
121 views

Having a read loop that manipulate data from another function. One of the tasks in the loop is to record widest text in "some columns". At the end of the loop the width is printed out, but ...
Darkthrone's user avatar
6 votes
3 answers
1k views

I have a two-column file that you can create as follows cat > twocol << EOF 007 03 001 03 003 01 137 12 001 11 002 01 002 02 002 03 001 02 002 04 137 94 010 21 001 01 EOF The resultant file, ...
bballdave025's user avatar
0 votes
2 answers
54 views

I am on Ubuntu 22, and I have a large tree of files with annoying names that include numeric values in a variety of positions. Something like: ./2 ./2/9 ./2/10 ./2/8 ./1 ./1/2 ./1/1 ./1/11 ./11 ./11/...
superstator's user avatar
6 votes
3 answers
1k views

I'm reading this blog at the moment: https://www.baeldung.com/linux/dir-find-largest-file-recursively And I am asking about this command: find /usr/lib -type f -printf "%s\t%p\n" | sort -n | ...
achhainsan's user avatar
0 votes
1 answer
172 views

I am using ls on MacOS 11.6.1. In the output, the Upper cases are displayed before the lower case. For example, I get the following output: $ ls Blabla.txt GAGAS.txt asdf.txt blabla.txt and would ...
ecjb's user avatar
  • 495
4 votes
4 answers
572 views

Is there a way to sort the list of positional parameters in POSIX sh? Each positional parameter could contain arbitrary characters (e.g. spaces, newlines, tabs, etc.). The sort algorithm should be ...
Flux's user avatar
  • 3,318
1 vote
1 answer
780 views

I noticed that Nautilus(GNOME Files) does not fully sort alphabetically. $ touch 1 $ touch 2 $ touch 3 $ touch '!2' Then the files are displayed in the following order: !2 1 2 3. This is fully ...
lv04438's user avatar
  • 11
-2 votes
2 answers
181 views

I have a text file containing paths of various wav files. But when they are created they are sorted based on alphabetical order. Hence the paths are like this /home/wav_path/...
Turing101's user avatar
  • 153
1 vote
4 answers
288 views

I am using nsxiv to view JPEG and PNG images on FreeBSD. However, I am unable to find a way to sort and filter the images by modification time to view them in nsxiv on FreeBSD. On Linux with GNU ...
Flux's user avatar
  • 3,318
0 votes
0 answers
19 views

I have a csv (Fieldseparator is the ',') file with data in it and I would have to prepare the csv before reading it (mainly just sort it) into variables. How can I read the sorted stream into ...
roediGERhard's user avatar
0 votes
1 answer
43 views

So, let's say I have a script that uses find to print paths with null-terminated filenames. I also want to print another version of the output where each path is sorted by its basename. I want to ...
Eduardo Perez's user avatar
3 votes
3 answers
411 views

I have file output in a CSV file I want to sort by date time but the date time appears as below, with the time and year appearing in a different order. Using this command to produce the file listing: ...
Steve's user avatar
  • 31

1
2 3 4 5
21