Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Exercise: Sort SNMP numbers

Given a file with SNMP numbers (one number on every line) print them in sorted order comparing the first number of each SNMP number first. If they are equal then comparing the second number, etc...

input:

1.2.7.6
4.5.7.23
1.2.7
1.12.23
2.3.5.7.10.8.9
1.2.7.5

output:

1.2.7
1.2.7.5
1.2.7.6
1.12.23
2.3.5.7.10.8.9
4.5.7.23