Skip to content

Instantly share code, notes, and snippets.

View thomedes's full-sized avatar

Toni Homedes i Saun thomedes

  • Tarragona, Spain
View GitHub Profile
{
"basics": {
"name": "Toni Homedes",
"label": "Embedded Programmer and DevOps",
"picture": "https://ca.gravatar.com/avatar/ba5f96391f5499c01e98d03957e31f98",
"email": "toni@homedes.net",
"phone": "+34 647-10-77-35",
"website": "https://toni.homedes.net/",
"location": {
"postalCode": "08330",
@thomedes
thomedes / README.md
Last active June 29, 2021 16:20
Compare string versions in bash

version_cmp()

Simple function to (properly) compare version strings in bash

The problem

You can not do alphabetic comparison:

@thomedes
thomedes / ini.sed
Last active August 17, 2023 20:41
sed one-liners to deal with .ini / .conf files
# List all [sections] of a .INI file
sed -n 's/^[ \t]*\[\(.*\)\].*/\1/p'
# Read KEY from [SECTION]
sed -n '/^[ \t]*\[SECTION\]/,/\[/s/^[ \t]*KEY[ \t]*=[ \t]*//p'
# Read all values from SECTION in a clean KEY=VALUE form