'Get version of each installed formula in Homebrew?

We are trying to get the version of every package installed.

Can anyone please help to provide brew command that will print like this?

Name            Installed     Latest
ant               1.9.4        1.9.4
maven             3.6.3        3.6.3
[email protected]      10.2.31.     10.2.37
node              v12.1.0      v14.0

This is command tried:

brew list --formula | xargs -n1 -P8 -I {} sh -c "brew info {}| egrep '[0-9]* stable'|sed -e 's/stable//g' -e 's/HEAD//g' -e 's/(bottled)//g' -e 's/,//g' -e 's/\[keg-only\]//g' -e 's/://g'"|egrep 'node|maven|ant|mariadb'|grep -v "Warning"|column -t

And I am getting only this:

ant      1.10.9
maven    3.6.3
node     15.12.0
node@14  14.16.0

Need advise on how to retrieve the latest version from public and append?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source