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

learn more… | top users | synonyms

0
votes
2answers
170 views

Sort a text file according to a character within a field

I have a file named : newfile which consist of the following data 1 AC BB CC 2 AB CC DD 3 CA BB CC 4 BE DD EE 5 BD AA AA I type the following command in bash to sort the data according to the ...
0
votes
1answer
74 views

Sort in Linux for column, keeping other values intact

NODE_154_length 847 2997 NODE_154_length 3283 4509 NODE_154_length 4672 5715 NODE_154_length 6977 7768 NODE_29_length 3790 4317 NODE_29_length 4356 4712 NODE_29_length 4356 4712 ...
0
votes
1answer
72 views

Why this sort command gives me an empty file? [duplicate]

prova1 is a file with some text. When I run this code prova1 become empty: sort prova1 > prova1 I know that to achieve the effect I can do: sort prova1 -o prova1 I would just know the reason ...
0
votes
1answer
2k views

How to sort by multiple columns? [duplicate]

I have a tab-separated file, and I want to sort it by its columns 9, 14, and 16. By this I mean that all rows that agree at column 9 should be sorted by column 14, and among these, those that also ...
0
votes
1answer
142 views

How to sort date: YYYY.MM.DD. HH:MM?

INPUT: b|2013.06.03. 18:47| a|2013.06.03. 13:15| c|2013.06.03. 13:53| needed OUTPUT: a|2013.06.03. 13:15| c|2013.06.03. 13:53| b|2013.06.03. 18:47| How can I sort the dates correctly in ...
0
votes
1answer
569 views

Sort a file based on 1 column [duplicate]

Possible Duplicate: how do you sort du output by size? I have a text file generated from the output of du --max-depth 1 -h > sizeOfHomeFolder.txt It's contents are in this format: $ ...
0
votes
1answer
29 views

Sorting file by second column

How can I manipulate a two columns tab-separated text file by sorting by the first element of the second column (only if the first column element is the same)? Exemple: Input File 1 A 1-2 A ...
0
votes
1answer
56 views

How to perform custom sort

I have the following line in a file : [[0, [0, '1']], [1, [0, '2']], [2, [0, '3']], [3, [0, '4']]] [[0, [1, '5']], [1, [1, '6']], [2, [1, '7']], [3, [1, '8']]] [[0, [2, '9']], [1, [2, '10']], [2, ...
0
votes
3answers
387 views

Sorting IP address according to the second field in file

in my ksh script I need to add the following task ( OS - linux/solaris ) I have the following file more test.txt /etc/backup/app 172.1.120 172.110.120 /etc/backup/app 172.1.120.12 ...
0
votes
1answer
63 views

Why am I not getting correct output with sort command [closed]

This is what I have tried so far sort /etc/passwd -t: -k1 > ~/passwd.bylogin I keep getting an error that the output is wrong. The question is: Sort the /etc/passwd file in alphabetically ...
0
votes
2answers
38 views

Sorting by Last Name in the Scond Column

I'm trying to sort a file that has entries that look like so: Essie | Vaill | 14225 Hancock Dr | Anchorage | AK | 99515 907-345-0962 Please note the "|" stand for tabs of ...
0
votes
3answers
105 views

selecting rows that have the same value [closed]

I have a problem in selecting rows that have the same value. My data is too huge to go row by row to do that. I want you guys to let me know scripts that can perform this. My data looks like as ...
0
votes
1answer
59 views

Get the most recent backup files [duplicate]

I'm googling for this, but the terms are so generic I'm getting way too many false positives, so what the hey, I'll ask here. I'm sure there's a simple answer but I don't generally script in *nix. ...
0
votes
1answer
103 views

Remove repeated words with suffix in a file

I have a list of records in a file as in below example word_word1 word_word1_acc word_word2_acc word_word3_acc word_word4 I need to remove only word_word1_acc line in the file as it is only a ...
0
votes
0answers
21 views

Sorted HTML table

I need a very quick and easy way to sort HTML tables. The table rows contain images that should stay with their appropriate row. I tried pasting my HTML into Libre Office calc, but the images are not ...
0
votes
1answer
65 views

What option(s) would you use to sort a file named foo in place, that is replacing the original file with the sorted version? [duplicate]

I have this homework question. I looked at the man page for sort and I believe the answer is -o, --output=FILE Is that correct? It is a Fedora server. We're supposed to look on man pages, if there ...
0
votes
1answer
208 views

How does -k flag work in sort command? [duplicate]

I have got a dataset like this: manufacturer,model,year,mileage,price plym fury 1970 73 2500 chevy malibu 1999 60 3000 ford mustang 1965 45 10000 volvo s80 1998 102 9850 ford thundbd 2003 15 10500 ...
0
votes
1answer
111 views

How to sort a Diary?

Diary has entries with month and day, no years, in the format %D_%M.tex but index in wrong order because of wrong sorting and poor filename -format. How should I call my Diary -entries to get them ...
-1
votes
1answer
19 views

How do I sort the signal buses with bits in ascending order?

I am trying to sort a file with signal buses. I am looking for result where the bits are in ascending order -- 2 followed by 3 and not 20. cat file1 |sort file1 cls_16_snap[2] cls_16_snap[20] ...
-1
votes
1answer
119 views

Select a range of files from directory structure /year/month/date.db

I have databases stored in the directory structure year/month/date.db an example would be db/2013/10/15.db I need to be able to select a range of these with a script ("dbSelect ...