Tagged Questions
1
vote
2answers
20 views
How can I sort a long list of text alphabetically?
How do I sort rows of text alphabetically without using specialized third party software or plugins (like Notepad++/Word/Excel/et al)?
I suppose what I'm perhaps asking is -- How do I sort rows of ...
2
votes
3answers
93 views
weird filename sorting (bash, ls, sort)
Good day, everyone.
I'm trying to feed my music to mplayer, like this: mplayer *, but getting wrong track order.
Here's what I get with ls (as well as ls -1, ls -1 | sort), note the order of the ...
2
votes
1answer
49 views
How to output a partial or a number from a mataching in grep or ack
I have a text file demo.txt like below.
This is a line with id (9)
This (8) is another line with id
(10) This is a line with id too
11 This line does nothing
The file has some lines with id ...
0
votes
1answer
84 views
Sort files based on their meta-data
At a local storage (ext3/ext4) I have thousands of files of various types. I need to sort them, however I can come up with the criteria to do so as long as it's possible to get an overview again.
I ...
1
vote
1answer
64 views
Sort columns next to last column in Linux
I have multiple files:
File 1
a 1 2
b 3 2
File 2
a 2 2 3
b 4 3 3
File 3
d 3 1 2 4
e 4 1 1 2
I'd like to sort the files according to the column next to the last column, after sort:
File 1
...
5
votes
1answer
78 views
Merge sorted lists
I have a few .txt files (in the same directory) that look like this:
123 carrot
50 apple
13 tomato
5 potato
2 pear
and
100 carrot
10 apple
3 tomato
2 potato
...
0
votes
4answers
294 views
Reverse order using command
Is there a way i use the ps --sort option on a linux to display the processes in reverse order based on the process ID or is there another command i can use for this?
0
votes
1answer
85 views
gnu sort alphanumerically by one column, followed by numerically in next column?
How can I sort a text file with GNU sort starting with alphanumeric sort by one column, followed by numerical sort in the next column?
I tried sort -n -k1,2 file.txt, but it doesn't seem to work:
...
1
vote
1answer
86 views
sorting a file by column, possible values are number, Inf, -Inf, NA
I have a tab-separated ASCII file.
One of the columns contains numbers which always have a decimal point (like 0.311225363556077).
However, in this column entries might also be any one of these ...
0
votes
1answer
252 views
Solaris + sorting file according to date and time by sort command
I have along list that created in /var/tmp/file.txt from some script (in Solaris machine) the following list have 4 fields
please advice how to sort the list according to the following TIMESTAMP ( by ...
3
votes
1answer
207 views
Sorting files based on a timestamp within the file
I have a bunch of files which contain an ascii header with a time stamp WITHIN the file, followed by a large chunck of binary data. I would like to list the files sorted by this time stamp, at the ...
3
votes
2answers
656 views
How to physically reorder files `03.mp3 01.mp3 02.mp3` (`ls -f`) in a directory?
The physical order of the files matters when I copy them onto my USB stick and listen in car mp3 player. Most of my music album folders are unsorted, e.g. ls -f may produce:
03.song3.mp3
01.song1.mp3
...
3
votes
2answers
203 views
How to reorder folders? (as displayed in `ls -U`)
I've got a number of unordered folders on a memory stick, which my car stereo shows in order of their real position on the stick (i.e. same as ls -U) What's the easiest way of physically reordering ...
0
votes
1answer
32 views
Sort xdebug output
I have a xdebug function trace output that looks like this:
1130.8156 482236096 -160 -> memory_get_usage()
1130.8156 482236112 +16 -> X
1130.8157 ...
2
votes
1answer
1k views
Equivalent of gnu `sort -R` on OSX?
The GNU sort text utility features a non-standard -R option to randomize input lines (presumably by sorting on a hash).
OSX sort does not have this extension. Is there similar functionality ...
0
votes
3answers
549 views
Linux sort all data in memory
For Linux command sort, how do I force sort to load all input into memory and sort assuming I have enough memory? Or is it best to use a RAMDISK to store the input before feeding it to sort?
20
votes
7answers
22k views
Unix/Linux find and sort by date modified
How can I do a simple find which would order the results by most recently modified?
Here is the current find I am using (I am doing a shell escape in PHP, so that is the reasoning for the variables):
...
4
votes
2answers
1k views
GNU sort by case-sensitive
The sort utility in Ubuntu 10.04 (Lucid) always sort by case-insensitive, just like if you specify --ignore-case to it.
The two sort just give the same result:
echo -e "c\nb\nB\na" | sort
echo -e ...
1
vote
6answers
552 views
Best way to manually sort random text files?
I have about 1000 text files and I need to view each, and move it to a folder if it's the correct one. I can only do basic sorting by length/size, and I can't grep because the text is random. How can ...
1
vote
4answers
3k views
Merging and sorting multiple files with “sort”
I have a bunch of text logfiles in the following format:
ID (17 characters)
Timestamp (14 characters YYYYmmddHHMMSS e.g. "20060210100040" -> 2006/02/10 10:00:40)
Random data (? ...
1
vote
2answers
59 views
When your field-terminating char appears within field values
I've had a very colorful morning learning the innerparts of Linux's sort command, and have come across yet another issue that I can't seem to find an answer for in the documentation.
I'm currently ...
1
vote
1answer
152 views
SORT empties my file?
I'm attempting to sort a csv on my machine, but I seem to be erasing the contents each time I use the sort command. I've basically created a copy of my csv lacking the first row:
sed '1d' ...
0
votes
1answer
899 views
How do I salvage files from the lost+found folder?
Well, I screwed up my external hard drive and now everything is in the lost+found folder. I can barely look through it because there is several tens of thousands of files (buncha inode things) and a ...
11
votes
4answers
8k views
In bash, how to sort strings with numbers in them?
If I have these files in a directory
cwcch10.pdf
cwcch11.pdf
cwcch12.pdf
cwcch13.pdf
cwcch14.pdf
cwcch15.pdf
cwcch16.pdf
cwcch17.pdf
cwcch18.pdf
cwcch1.pdf
cwcch2.pdf
cwcch3.pdf
cwcch4.pdf
cwcch5.pdf
...
10
votes
6answers
3k views
Sorting human readable file sizes
How can I sort a list using a human-readable file-size sort, numerical sort that takes size identifier (G,M,K) into account? Can I sort "du -sh" output for example?
Problem:
Consider the problem of ...