0
votes
1answer
37 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
49 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 ...
1
vote
1answer
238 views

On the command line, what is a “general” and “string” numeric value when sorting?

According to "man sort" there are two ways to sort numerically: -g, --general-numeric-sort compare according to general numerical value and -n, --numeric-sort compare ...
6
votes
1answer
118 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 ...
0
votes
2answers
178 views

How do I sort command-line output?

I'm trying to use du to sort the output by filesize, but it doesn't looks like there's an option for that. Can I pipe it into another command to handle the sorting?
1
vote
1answer
241 views

Command-line sort and copy text files to one single file renders an error

I stumbled on question 217394 which explains how to copy files sorted alphabetically into one single file. Trying to implement the command myself rendered the following error message: The system ...
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?
3
votes
1answer
487 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 ...
1
vote
1answer
394 views

order for loop output command prompt

I'm using the following command to list some of my favorite videos in a directory (and redirect the output into a text file): for %i in (*avi *.mkv *mp4) do @echo %~ni I'd like to alphabetically ...
1
vote
1answer
247 views

How do I re-sort a list of files grouped by directory?

From within a DOS batch file, how can I crudely re-sort a text file containing a manually maintained list of source files, so those files listed (from the same directory) in the small example extract ...
1
vote
1answer
1k views

specify the sort order in “copy /b *.dat foo” in Windows cmd

Normally, when I do a copy /b *.data foo in Windows cmd, the *.data files are catenated in the sorted order into the destination file foo. This matches my desired behavior. However, I just met a ...
7
votes
6answers
954 views

Joining text files with 600M+ lines

I have two files, huge.txt and small.txt. huge.txt has around 600M rows and it's 14 GB. Each line has four space separated words (tokens) and finally another space separated column with a number. ...
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
185 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' ...