Getting a tool version from asdf (improved)

$ asdf current nodejs 2>&1 | awk '{print $2}'
22.11.0
Example: Print a version of Node.js managed by asdf.

It’s an improved version of the previously mentioned solution.

Kudos to André Wendt who showed me how to replace sed and cut with awk.


TIL rating:
good to know

Read next

$ asdf current nodejs 2>&1 | sed -e "s/ \{2,\}/ /g" | cut -d" " -f2
20.17.0
Example: Print a version of Node.js managed by asdf.