Depends on how bad you want to do it, how much control you have over the system :)
How about a tactic like this...
Read the file with an fdw:
CREATE EXTENSION file_fdw;
CREATE SERVER file_fdw_server FOREIGN DATA WRAPPER file_server;
CREATE FOREIGN TABLE pghba (
username text,
pass text,
uid int4,
gid int4,
gecos text,
home text,
shell text
) SERVER file_server
OPTIONS (format 'text', filename current_setting('hba_file'), delimiter E'\t', null '');
Parse the contents with SQL (exercise left for the OP) and write back out to file with
COPY () TO current_setting('pghba_file')
statement.
Reload the configuration file with:
SELECT pg_reload_conf();
This is obviously not a complete working example, it's more of a strategy that can get you where you want to go. That is, if you want to go there that badly.