-1

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
Cyrus
  • 77,979
  • 13
  • 71
  • 125
Programmer
  • 5,276
  • 3
  • 9
  • 33

1 Answers1

3

pyrcc5 is printing the version string to stderr, not stdout. Try pyrcc5 -version 2>&1 | cut -dv -f2.

hobbs
  • 206,796
  • 16
  • 199
  • 282