0
votes
1answer
45 views

Sort numbers in left to right in ascending order

How to arrange in ascending order from left to right in vi or with the sort command? Sample before arrangement: 2 3 3 6 5 1 4 2 5 8 I want it in this way: 2 3 3 6 1 5 2 4 5 8
0
votes
0answers
37 views

why is my sort slower with more ram?

System specs below. I recently purchased 2X4 RAM: Corsair XMS3 8 GB (2 x 4GB) 1333 MHz PC3-10666 240-Pin DDR3 Memory Kit CMX8GX3M2A1333C9 I already had 2X2 in there for a total of 12GB: Corsair ...
0
votes
0answers
40 views

If sort created temporary files, does it mean it's out of RAM memory?

I was sorting a large file (101MB - about 700MB after unzipping) using sort command on server that has 48GB of memory. It was the only heavy job it was doing at that time. However I noticed that sort ...
0
votes
1answer
41 views

What's the strategy used by sort when field not found?

I got a file named test, its content is like 111 222 11 22 111 223 12 22 33 11 2 25 222 331 11 2 33 2 1 33 33 22 33 I used: sort -bk2.3 test But the result confused me, those lines which doesn't ...
0
votes
2answers
51 views

Why “ sort file > file ” would remove all the content of that file?

Today I'm learning sort command. I find that, I can use sort file1 > file2 To inject the sorted file into file2 But when I use sort file1 > file1 file1 become empty! Why?! I know I ...
0
votes
1answer
69 views

Linux: Sort /etc/fstab by the mountpoint field

On linux, how would you sort the /etc/fstab file by mountpoint? I'm interested in sorting a section of fstab (whatever is mounted under /x) in such a way that parents are mounted before its children ...
0
votes
1answer
37 views

Can I remove the original file while running “sort”?

I'm sorting a huge file, around 400 gigabytes. I'm running out of the disk space and I must do something quickly. Let's assume the original file is called original_file. So I execute (simplified) it ...
0
votes
3answers
52 views

Extract identical files from two directories

I am looking for a linux solution for the following problem: Given two directories with a large number of files. All file names are random and different in both directories. The contents of some of ...
2
votes
1answer
743 views

Is there a way around broken pipe?

I have a directory with a large number of files. ./I_am_a_dir_with_many_subdirs/ Within a script I'd like to find all subdirs in it, to sort them and to output to a bash array. So, I do: ...
0
votes
1answer
191 views

Use the ascii code of a character as an input to sort

I'd like to sort a file with a specific delimiter (ascii 0xff) and the records are zero-terminated. I cannot use the following command though: $ sort -z -t \xff -o data data The error message is: ...
0
votes
1answer
113 views

SortTV perl script error

I'm trying to use a perl script named SortTV (http://sourceforge.net/projects/sorttv/) Every dependencies is installed but I got an error & can't understood it... It's not a specific problem of ...
4
votes
2answers
238 views

Linux command line / Move files filtered by lexicographic order

I have some files in a directory that are named IMG_0001.jpg ... IMG_9999.jpg. I want to move to another directory the files that lexicographically have a name greater than IMG_9431.jpg How can I do ...
6
votes
1answer
121 views

List of files under a directory in name order

I wanted a list of files under a directory in name order to pass to an image viewer. I am using find $PHOTODIR -iname "*.jpg". Unfortunately this produces the images out of order. On a USB key ...
1
vote
2answers
177 views

How can I sort and de-dupe a very long list of words?

I have a 400 megabyte file. The file is a list of words, each word on a single line. End of lines are a mix of cr/lf and lf. Some of the words are unicode. I'd prefer answers for Linux or Windows ...
0
votes
1answer
59 views

how to delete a file after sorting in Linux

I have a huge file that needs to be sorted in Linux, for example: sort -k1,1 -k2,2n /dir/fileA.sam > /dir/fileA_sorted.sam Because I ran out of disk space, is there a way to delete the original ...
1
vote
2answers
964 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
311 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
236 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
153 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
195 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
134 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
1k 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
221 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
136 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
516 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
554 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
418 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
34 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 ...
12
votes
1answer
4k 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
1k 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?
41
votes
12answers
51k 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): ...
1
vote
6answers
710 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 ...
3
votes
4answers
7k 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
66 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
188 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
1k 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 ...
16
votes
6answers
16k 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
6k 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 ...