sort

Is it possible to sort the letters in a word in a line of text?

Is it possible to sort the letters in a word in a line of text? So I have a file full of test commands that I like to run against some of my functions to make sure they are handling all possible situations correctly. No point in having duplicate commands tho. Here’s some examples: rap …

Total answers: 5

sort in shell using multiple -t

sort in shell using multiple -t I have a file that contains: 192.168.130.175 2014-09-04 10:25:01 /index.html 192.168.138.244 2014-09-04 11:23:00 /index.html 192.168.138.244 2014-09-04 10:29:37 /products.html 192.168.138.244 2014-09-04 11:22:49 /products.html 192.168.83.173 2014-09-04 10:05:17 /products.html 192.168.130.175 2014-09-04 12:24:24 /products/004.html 192.168.130.175 2014-09-04 10:09:13 /products/296.html 192.168.130.175 2014-09-04 11:01:20 /products/296.html 192.168.83.173 2014-09-04 12:19:55 /products/560.html I want to, first, sort by IP …

Total answers: 3

List all files in a directory, recursively, sorted by modification date

List all files in a directory, recursively, sorted by modification date The main answer of Sort the files in the directory recursively based on last modified date gives a method to list all files in a directory, recursively, sorted by modification date: find -printf "%TY-%Tm-%Td %TT %pn" | sort -n However it doesn’t list only …

Total answers: 1

Multilevel numeric path sort

Multilevel numeric path sort 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/page 6 ./11/page 05 ./11/page 4 I want to sort this according to the numeric …

Total answers: 2

Reverse sorting of 2 textblocks in larger set of textblocks

Reverse sorting of 2 textblocks in larger set of textblocks I have a list of data, separated into blocks by headlines. The headlines are marked by 6 ‘=’ signs at beginning and end. There is a limited set of headlines that may appear, but not all of them appear every time. They will however appear …

Total answers: 4

Awk- Compare Numbers from Two Files and write Differences in New File

Awk- Compare Numbers from Two Files and write Differences in New File I have two lists with item numbers and want to mark the difference between these lists by writing the numbers wich aren’t in both files in a new file. Both Files have the item number in column 2 and part ID in column …

Total answers: 4

Display the results in an alphabetical order, independently of their case

Display the results in an alphabetical order, independently of their case 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 like to have instead: $ ls asdf.txt blabla.txt Blabla.txt GAGAS.txt …

Total answers: 1

Why is ls sorting Chinese filenames by length?

Why is ls sorting Chinese filenames by length? I’ve run into a bit of a weird behaviour that I don’t fully understand with ls and Chinese filenames. I’m running macOS 13.6.1 with SIP enabled (no core OS modifications), MacPorts installed, and US English as the primary language. First, run this little script in a blank …

Total answers: 2

Sorting a text file based on numerical values present in each line

Sorting a text file based on numerical values present in each line 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/converted_Interpreter_TC_100.wav /home/wav_path/converted_Interpreter_TC_101.wav /home/wav_path/converted_Interpreter_TC_102.wav /home/wav_path/converted_Interpreter_TC_103.wav /home/wav_path/converted_Interpreter_TC_104.wav /home/wav_path/converted_Interpreter_TC_105.wav /home/wav_path/converted_Interpreter_TC_106.wav /home/wav_path/converted_Interpreter_TC_107.wav /home/wav_path/converted_Interpreter_TC_108.wav /home/wav_path/converted_Interpreter_TC_109.wav /home/wav_path/converted_Interpreter_TC_10.wav /home/wav_path/converted_Interpreter_TC_110.wav /home/wav_path/converted_Interpreter_TC_111.wav /home/wav_path/converted_Interpreter_TC_11.wav …

Total answers: 1

Group IP addresses belonging to the same /24 network

Group IP addresses belonging to the same /24 network I have a file containing a list of both IPv4 addresses and /24 networks. The IP addresses are already unique and sorted by all four octets. I would like to use bash to group the addresses that belong to the same /24 subnet (if there is …

Total answers: 1

sort the whole .csv based on the value in a certain column

sort the whole .csv based on the value in a certain column I have a csv file with different revenues. I want to sort the csv file on revenue from high to low value. I can’t find how to do this in terminal without the use of python. I don’t want to use python. I …

Total answers: 6

Bash sort lines starting with punctuation in non-dictionary order

Bash sort lines starting with punctuation in non-dictionary order I have a file containing lines, some of which start with a ! character, some with a ? character, and some with a space ( ) character. The second character is always a letter of the alphabet. When I try to use the bash sort command …

Total answers: 1

sort by two numerical columns

sort by two numerical columns I am trying to sort a genetic file based on chr (column 2) and position (column 3) that both start from lower to higher. my table is like this in large file SNP CHR BP A1 A2 effect_allele_frequency BETA standard_error P rs10875231 1 100000012 T G 0.405 -0.0456807 0.02260471 0.04335677 …

Total answers: 1

Collect chars from strings and print their unicode

Collect chars from strings and print their unicode Context (skip, if you don’t care; read, if you suspect I’m totally on the wrong track) For an embedded system with small memory, I want to generate fonts which contain only those glyphs actually needed. so at build time, I need to scan the language files, extract …

Total answers: 4

CSV sort by column 3 and counter in front

CSV sort by column 3 and counter in front I would like from this table "ResNR";"ResNAME";"CustomerNAME";"CustomerID";"Date";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";" "12431";"TEST";"Kunde 1";"10272";"20.06.2017 10:35";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";" "12431";"TEST";"Kunde 2";"10207";"13.11.2017 14:08";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";" "12431";"TEST";"Kunde 2";"10328";"09.05.2018 09:22";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";" "12431";"TEST";"Kunde 1";"10189";"16.05.2018 17:47";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";" "12431";"TEST";"Kunde 3";"10189";"18.06.2018 20:07";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";" "12431";"TEST";"Kunde 1";"10229";"13.11.2018 11:14";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";" "12431";"TEST";"Kunde 2";"10348";"28.01.2019 09:06";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";" "12431";"TEST";"Kunde 3";"10340";"06.02.2019 11:13";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";" "12431";"TEST";"Kunde 1";"10349";"22.02.2019 17:06";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";" "12431";"TEST";"Kunde 2";"10333";"27.02.2019 20:18";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";" This is how the output should be Everything should …

Total answers: 3