Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save shellscriptx/eaee37047d04aeaae0c42e6b070a80b1 to your computer and use it in GitHub Desktop.
Save shellscriptx/eaee37047d04aeaae0c42e6b070a80b1 to your computer and use it in GitHub Desktop.

1. curl + sed

$ curl -sL https://www.python.org | sed -nr 's/^<p>Latest:[^>]+>Python\s+([0-9]+(.[0-9]+)+).+/\1/p'

2. curl + grep

$ curl -sL https://www.python.org | grep '^<p>Latest:' | grep -oP '(?<=Python )[0-9]+(.[0-9]+)+'

3. curl + bash

$ re='<p>Latest:[^>]+>Python\s+([0-9]+(.[0-9]+)+)'
$ [[ $(curl -sL https://www.python.org) =~ $re ]] && echo ${BASH_REMATCH[1]}

Comunidades

Gostaria de contribuir com o projeto? clique aqui

padrim

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment