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

learn more… | top users | synonyms

1
vote
2answers
37 views

list files with similar names sorted by similarity [closed]

Is it possible to search files and list them descending by similarity ? e.g.: Following files are in /: heo HELLO helo hello When I search for 'hello' I would like to have a List like: ...
3
votes
1answer
89 views

Sorting Before Sending the Output to Terminal

I have below script that I get details of some IPs in a blacklist. check.sh blacklist_ips=' 5.56.148.140 94.73.159.66 113.171.224.169 107.150.42.226 195.159.233.44 89.19.7.58 ...
0
votes
1answer
40 views

How to sort or uniq a live feed

I'm looking to sort and isolate IP from a tcpdump live feed. tcpdump -n -i tun0 "tcp[tcpflags] & (tcp-syn) != 0" | grep -E -o "([0-9]{1,3}[\.]){3}[0-9]{1,3} works just fine but when I try to ...
1
vote
2answers
191 views

How to sort files in a directory based on the index number of the file?

I have files like : 4-some file.mp4 1-another file.mp4 3-one more file.mp4 2-got another file.mp4 and so on. Using the command line to play the files in vlc using vlc * plays them in unsorted ...
0
votes
4answers
60 views

Find folders that begin with the same string

I have more than 1000 subdirectories in a folder. Some of them begin with the same string and I want to find all directories where the first 5 characters of their name are also the first 5 of another ...
-3
votes
1answer
49 views

What command lines should I use for the following? [closed]

What command lines should I use for... printing a list of users running bash now in alphabetical order print the count of users who are running bash right now save the list of users who are running ...
3
votes
3answers
56 views

Sort all rows horizontally by reference to columns in a particular row

I need to sort horizontally, not vertically, and sort seems to be designed for vertical operation. E.g. I have three rows as follows: banana/orange/apple/mango potato/tomato/onion/garlic chair/table/...
5
votes
2answers
106 views

What is a good way to sort two log files as they are created?

I have two scripts running, both of which output a log file. I'd like to make a third script that can sort these logs by time stamp and merge them into one file as they are created. What is a good ...
1
vote
4answers
42 views

How to extract first name in Alphabetical order from multiple files

Say I have File1: Aaron Vernon Troy Roy File2: Jason Derek Mariano Alex I want to display: File1: Aaron File2: Alex What would be a single line bash command that could do both? I was ...
2
votes
1answer
104 views

How to sort files separately without merging?

File1: Brazil New Zealand Argentina Uruguay File2: Chile Russia Latvia Switzerland I realize that the command sort -n File1 File2 will sort all the files merged together and display it ...
3
votes
4answers
150 views

Trying to sort two list of numbers and using uniq to get the intersection

I have a file A and B so I used to the following command... (sort -n A B) | uniq -d which should give me the numbers which occur in both files. 1 2 2 3 4 5 11 11 12 31 These are the numbers I ...
1
vote
1answer
44 views

Sort text by specific location on each line

What I want to achieve is sorting lines of text by a specific point in the text (the lines of text have no spaces or columns). I've worked out a solution to this, but I want to know if there is a more ...
0
votes
1answer
33 views

how to print the count of matched /unmatched patterns and print multiple patterns separated by line

how to print the count of matched /unmatched patterns and print multiple patterns separated by line. Input example (test.log): This 23 line has eight 8888 This 11 line has three 3333 need 12 to ...
1
vote
2answers
55 views

Nautilus: How are files sorted?

I am quite new to Debian 8.4. I am not sure if this is the right community on stackexchange to pose this question. Please tell me, if not. My question: I am using the Nautilus file manager. I view a ...
2
votes
0answers
55 views

Sort mount points by mount time

With no command line arguments mount displays all mounted file systems, e.g.: /dev/sdy8 on /bar type ext4 (rw,relatime,lazytime,data=ordered) /dev/sdx6 on /baz type ext4 (rw,relatime,lazytime,errors=...
4
votes
5answers
105 views

How do I sort on the first column every 4 lines in a file with a key in the second column

Example File : first column can have fixed set of 4 unordered values world1.com,world2.com,world3.com or world4.com second column is a key belongs to each line such that each of the four sets has ...
18
votes
3answers
1k views

Scalability of 'sort -u' for gigantic files

What is reasonable scalability limit of 'sort -u' ? (in dimensions of "line length", "amount of lines", "total file size"?) What is Unix alternative for files exceeding this in dimension of "amount ...
0
votes
1answer
41 views

Using Perl for Even/Odd numbers

Currently, I'm using a process to create a very specific set of four files. The Process I'm using is shown in the attached Process Image, below: The first line is part of a solution, given to a ...
3
votes
3answers
123 views

Using grep/sort/find to extract unique values

I have a bunch of text files that are named in YYYYMMDD.Txt format (so today would be 20160420.Txt). Each file is basically a log that contains a timestamp and and a unique ID, each value is ...
3
votes
1answer
73 views

GNU sort --compress-program compressing only first temporary

I am sorting big files (>100Go), and to reduce time spent on disk writes, I am trying to use GNU sort's --compress-program parameter. (Related: How to sort big files?) However, it appears in certain ...
2
votes
1answer
67 views

POSIX Awk sort array

I would like to sort an array with POSIX Awk, however I have discovered that: asort() asorti() PROCINFO["sorted_in"] are all GNU extensions. Can this be done with without GNU Awk?
1
vote
0answers
20 views

gnu sort --stable option not working [duplicate]

I want to sort a text file with GNU sort, by the first field, with field separator ":": $ cat aa a:895502/ a:2013-05-24 # without --stable, last resort comparison $ cat aa | sort -t: -k1 a:2013-05-24 ...
3
votes
3answers
241 views

Join two files each with two columns, including non-matching lines

I'm trying to match and merge two sets of sorted data, one set per file. Each file contains two columns: the key field and the associated value. The resulting output should contain three columns: the ...
0
votes
1answer
77 views

removing duplicates with tail [closed]

How can I remove duplicate in tail output? I'm using tail -f file.txt | sort file.txt | uniq it stops tail after some sec
2
votes
3answers
112 views

How to sort files in Bash with ddmmyy timestamps in name

I have a series of files with names of the form "foo.date.bar" where "date" is a six digit field such as 310715. So for example foo.310715.bar foo.260815.bar foo.110815.bar foo.040815.bar I would ...
3
votes
2answers
37 views

Sort by last character of input, then by preceding number?

I have a file that looks like this: foo03a foo02b quux01a foo01a foo02a foo01b foo03b quux01b I'd like it ordered by the last character (so a and b appear together) and then by the preceding number,...
0
votes
1answer
39 views

linux - setting order in which files are read or output with utilities (sorting)

I'm having issues with programs reading files in the wrong order, and also outputting in an undesirable order with utilities such as ls. I've tried some of the LC_COLLATE options, but none of them ...
4
votes
1answer
73 views

What is the sort order when using conditional operators?

I wrote a bash script that processes a list of filenames (using glob expansion, as in for f in *) and then outputs a subset of this list to a file. Subsequently I read the content of this file into an ...
3
votes
2answers
47 views

Sorting by two columns

I need help with this homework assignment: Write a shell script named sales1 using nawk and sort commands to do the following: 1. print the file in two sections, east and west, with lines alphabetized ...
3
votes
2answers
71 views

Sorting based on last occurrence of character

I want to sort the file based on the text before the first comma, but also want a second level sort based on the date YYYYMMMDD in the sample input: Sample Input: AX,NO,NO,\PathAX/subj/defn/...
0
votes
1answer
55 views

Monitoring Server Connections - Netstat formatting issue

I have had a few issues with a server recently. So i just wanted to leave a window showing the unique and IP's of connected devices. I have been using: watch -n 5 "netstat -tn 2>/dev/null | grep :...
3
votes
1answer
45 views

Sorting Directories and Files

I want to use find and sort the response. I assumed that a simple pipe find ... | sort would do it, but the sorting behaviour is weird. For simplicity a simple text file: asdf/2/22 asdf/2/01 asdf/20/...
-1
votes
1answer
26 views

Sorting and outputting in another file

How can I sort a file then output it into another file I never created or do I have to create the file I want to put in. Might not make sense how I am typing it so... Let's say the file I have is ...
2
votes
5answers
44 views

How do I sort mixed text&numbers (eg hostnames)?

Given input with mixed text and numbers (w/o leading zeros), how can I get it sorted in the "natural" order? For example, given the following input (hostnames): whatever-1.example.org whatever-10....
2
votes
2answers
83 views

Sorting ls output where files end in numbers [duplicate]

Here is the output of my normal ls command: f1 f10 f11 f12 f13 f14 f15 f16 f17 f18 f19 f2 f20 f3 f4 f5 f6 f7 f8 f9 So I have 20 files. I need them displayed as : f1 f2 f3 f4 ...
1
vote
1answer
32 views

Calculate hits within a timespan from log file [closed]

I need to use UNIX utilities that implement out-of-core divide-and-conquer algorithms so to decrease the amount of virtual memory used (cap of 1 mb). I have a large data set that is an apache log file....
3
votes
2answers
45 views

How to pin certain files when using sort?

Normally I am more creative with Unix commands and pipes, but not today. So what I have is this: collage.jpg DCIM001.jpg DCIM002.jpg or this: 001.jpg 002.jpg boston-collage.jpg or sometimes ...
3
votes
1answer
33 views

Sort log data with bash

I have a log file containing such entries 192.168.1.1;query=/etc/security/limits.conf;date=02.03.16 192.168.1.1;query=/etc/security/limits.conf;date=01.06.15 192.168.1.2;query=/etc/security/limits....
0
votes
1answer
109 views

aix: how to sort ps by stime?

On AIX, for the top 10 cpu processes, I use ps aux | head -1; ps aux | sort -rn +2 | head -10 for the top 10 mem processes ps aux | head -1; ps aux | sort -rn +3 | head -10 How can I sort the ...
1
vote
1answer
34 views

sorting on two vertical columns

I have a file that I want to sort from the nth column (which is numeric) - not the nth field. The file looks schematically like: 1 Here are four words 9 8 5 2 Here's two 7 2 6 ...
0
votes
0answers
34 views

sort on column (not field) [duplicate]

I have a file that I want to sort on the nth column (which is numeric) - not the nth field; i.e. the file looks schematically like: Here are four words 9 Here's two 7 One ...
1
vote
2answers
79 views

How to reverse sort the output from grep -rc

I want to be able to sort the output from the grep -rc command, I am currently using the command: grep -rc "Pattern" . | sort -t: -rk2,2n however the list is still sorted from low to high, ...
0
votes
2answers
57 views

File sort by time issue

I have a requirement to identify sequence gap in a set of files. Sequence starts at FILENAME_0001 and ends at FILENAME_9999. After this the sequence is restarted from 0001. To implement a proper ...
3
votes
2answers
164 views

Is there a way I can grep recursively over all the files in the current directory to find a pattern and then print it in order of high to low?

So so far, the code looks like this: grep -rc 'Author' $1 It prints out all the files in the directory, which is taken as an argument. However, how would I sort the output (for example): - data1:...
1
vote
1answer
45 views

Why do different installations of sort sort punctuation differently?

I got a file with content like this: ----------- =========== -------- -=-=-=-=-=- When I sort in a linux os, it comes like this: $ sort 1.txt =========== -=-=-=-=-=- -------- ----------- ...
3
votes
2answers
94 views

How to sort data by the numbers in third column? [duplicate]

If I have a file consisting of data that looks as follows, how would I sort the data based on the numbers in the 3rd column ? The space between the first two columns are NOT tab delimited but some ...
0
votes
2answers
45 views

sort each column(field) in a file separately [duplicate]

I am aware that it is possible to sort primarily by one field and secondarily by another field. For example: $ echo -e "1 5\n1 4\n8 2\n1 9" | sort -k 1,1n -k 2,2n 1 4 1 5 1 9 8 2 $ However, am I ...
10
votes
1answer
236 views

How to sort a file based on a section of a field

I would like to sort a file : D104HN-D104HA 8.320 4.521 1.69e+05 -- D104HN-D104HB* 8.320 2.823 2.93e+05 -- A90HB#-A90HA 1.655 4.207 7.12e+05 -- ...
0
votes
1answer
31 views

sorting a file on column 1 [duplicate]

I have a file in this format which I want to sort RNU2-46P 0 RNU2-2P 9 RNU2-63P 5 RNU2-36P 6 RNU2-56P 8 RNU2-17P 0 I want to sort it on column 1 and get this output RNU2-2P 9 RNU2-...
0
votes
1answer
83 views

sort files twice

I have a series of 300+ files that I need to sort twice, once by the date and a second time within that date by part of the filename. The only standard in the names is that ends with *mmddyyyy<time ...