The following works just fine using cs2cs
.
$ echo 16.582941335 47.710445103 291.7692| cs2cs -f "%.3f" +init=epsg:4326 +to +proj=somerc +lat_0=47.14439372222222 +lon_0=19.04857177777778 +k_0=0.99993 +x_0=650000 +y_0=200000 +ellps=GRS67 +nadgrids=etrs2eov_notowgs.gsb +geoidgrids=geoid_eht2014.gtx +units=m +no_defs
However, the same transformation fails in PostGIS.
$ psql -d db -c "SELECT ST_AsEWKT(ST_Transform(ST_GeomFromText('POINT(16.582941335 47.710445103 291.7692)', 4326), '+proj=somerc +lat_0=47.14439372222222 +lon_0=19.04857177777778 +k_0=0.99993 +x_0=650000 +y_0=200000 +ellps=GRS67 +nadgrids=etrs2eov_notowgs.gsb +geoidgrids=geoid_eht2014.gtx +units=m +no_defs'))"