This brilliant little script by Amal-Alharbi works to convert multi-line complex OVID queries to a single-line PubMed format.
I have forked it and given him a star because there is a general lack of such open source tools avaiable presently. Here is how the demo works:
python convert_OVID_PUBMED.py query.txt
query.txt --> contains the query in OVID format
output file: pubmed.txt --> contains the query in PubMed format
works with python 3.8.5 and 3.10 which I used to test it prior to modding