5
votes
2answers
71 views

Sort one column only, keeping remaining columns untouched

How to (numerically) sort a specific column in a text file, without affecting other columns (irrespective of whether they are sorted or unsorted)? On other threads I found -s argument, but it does ...
3
votes
1answer
106 views

Sort only on the second column [duplicate]

I'm trying to sort a file where typically (not always) the lines are whatever:[A-Ba-b0-9_]: values where fields are separated with :. Some lines do not follow this pattern, I'm not interested in ...
1
vote
1answer
742 views

Sorting by one column then the

Say i have a output file with following: 010513 08:04 ROUTER1 192.168.1.1 68.130.5.10 HIT(1) 010513 08:04 ROUTER1 172.168.1.1 28.130.5.10 HIT(1) 010513 08:04 ROUTER1 122.168.1.1 ...
1
vote
3answers
173 views

How to sort and join at the same time?

I have 2 files, one having 2 columns, another having 1 column. The second file is sorted using sort -u. Now the task is I need to join this column with the first column of the first file, which is not ...
3
votes
4answers
2k views

How to reorder a large number of columns?

I'm looking for a pipeable one-liner to reorder a large number of columns (where manually entering the column numbers in e.g. an awk command such as awk '{print $3,$2,$1}' is not feasible). The order ...
4
votes
1answer
717 views

Linux sort second last column

I would like know how to sort the second last column ? It has the word "days=" in front of the number. I'm able to get the column with awk '{print $(NF-1)}', but sorting is wrong. 457000 ...