Writing energies in a separate readable file (other than <.edr> file and log file)

Is there any way by which we can write gromacs calculated energies in a separate data file (such as <.txt> file) during MD run?
I know
(1) we can extract the energies from <.edr> file.
(2) even we can use gmx dump to see/read the contents of <.edr> file.
(3) The same energies are also written in log file

But in all the three cases, the precision is poor. I