How to resolve the algorithm Sort a list of object identifiers step by step in the jq programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm Sort a list of object identifiers step by step in the jq programming language
Table of Contents
Problem Statement
Object identifiers (OID) are strings used to identify objects in network data.
Show how to sort a list of OIDs, in their natural sort order.
Let's start with the solution:
Step by Step solution about How to resolve the algorithm Sort a list of object identifiers step by step in the jq programming language
Source code in the jq programming language
def data: [
"1.3.6.1.4.1.11.2.17.19.3.4.0.10",
"1.3.6.1.4.1.11.2.17.5.2.0.79",
"1.3.6.1.4.1.11.2.17.19.3.4.0.4",
"1.3.6.1.4.1.11150.3.4.0.1",
"1.3.6.1.4.1.11.2.17.19.3.4.0.1",
"1.3.6.1.4.1.11150.3.4.0"
];
data | map( split(".") | map(tonumber) ) | sort | map(join("."))
You may also check:How to resolve the algorithm Execute SNUSP step by step in the Nim programming language
You may also check:How to resolve the algorithm Top rank per group step by step in the Clojure programming language
You may also check:How to resolve the algorithm Even or odd step by step in the Ada programming language
You may also check:How to resolve the algorithm String interpolation (included) step by step in the PL/I programming language
You may also check:How to resolve the algorithm Sum and product of an array step by step in the FreePascal programming language