Skip to content
Advertisement

Tag: sorting

Simple sorting in linux

I’m quite new to linux, and I can’t quite get to understand sorting. I need to sort a long file by column 4 and then column 5, ignoring the first line. The catch is, there are two separators – ‘.’ and ‘,’ – I don’t know how to make sort command to include both of them. I guess it has

File is not sort after sort

I have a problem with sorting my file. My file look like this geom-10-11.com 1 geom-1-10.com 9 geom-1-11.com 10 geom-1-2.com 1 geom-1-3.com 2 geom-1-4.com 3 geom-1-5.com 4 geom-1-6.com 5 geom-1-7.com 6 geom-1-8.com 7 geom-1-9.com 8 geom-2-10.com 8 geom-2-11.com 9 geom-2-3.com 1 geom-2-4.com 2 geom-2-5.com 3 geom-2-6.com 4 geom-2-7.com 5 geom-2-8.com 6 geom-2-9.com 7 geom-3-10.com 7 geom-3-11.com 8 geom-3-4.com 1 geom-3-5.com

python way to find unique version of software

I’ve multiple components of a software (let’s call it XYZ) installed on my linux (RHEL 6.2) server running python 3.3. I’m trying to covert my install/upgrade script from shell to python. For that I need to fetch the version number, but only once. In my python script I’ve added the below code I want to use python based commands instead

Sorting an array of dates in bash

I want to sort an array of dates. Example format: “2017-11-13_07-55-40” or Year-Month-Date_Hour-Minute-Second Answer Since your dates are already in YYYY-MM-DD-HH-MM-SS format, you can use numeric sort: To store output in another array use:

Bash sort -nu results in unexpected behaviour

A colleague of mine noticed some odd behaviour with the sort command today, and I was wondering if anyone knows if the output of this command is intentional or not? Given the file: We are looking to sort the file with numeric sort, and also make it unique, so we run: The output is: Now, we know that the numeric

Sort a find command to respect a custom order in Unix

I have a script that outputs file paths (via find), which I want to sort based on very specific custom logic: 1st sort key: I want the 2nd and, if present, the 3rd –separated field to be sorted using custom ordering based on a list of keys I supply – but excluding a numerical suffix. With the sample input below,

AWK – Show lines where column contains a specific string

I have a document (.txt) composed like that. And I want to show some information by column. For example, I have some different information in “info3” shield, I want to see only the lines who are composed by “test” in “info3” column. I think I have to use sort but I’m not sure. Any idea ? Answer You can use

Advertisement