I need to get the version number of a program from the following output:
~$ pyrcc5 -version
pyrcc5 v5.15.0
~$
Now I thought cut
could do the job:
~$ pyrcc5 -version | cut -f2 -d"v"
pyrcc5 v5.15.0
~$
But it doesn't cut away anything ?!?
~$ echo $(pyrcc5 -version) | cut -f2 -d"v"
pyrcc5 v5.15.0
~$
Even worse … Expected output would be
5.15.0
pyrcc5 is printing the version string to stderr, not stdout. Try pyrcc5 -version 2>&1 | cut -dv -f2
.