I think you could try using the linux 'ed' line editor as follows:
EDITOR=ed gcloud dns records --zone=myzone edit <<-EOF 12i , { "kind": "dns#resourceRecordSet", "name": "a.mydomain.org.", "rrdatas": [ "111.222.111.222" ], "ttl": 21600, "type": "A" } . ,wq EOF
This assumes that the top of the editing file looks something like this (so you are adding an addition to the 12th line)
{ "additions": [ { "kind": "dns#resourceRecordSet", "name": "mydomain.org.", "rrdatas": [ "ns-cloud-c1.googledomains.com. dns-admin.google.com. 2 21600 3600 1209600 300" ], "ttl": 21600, "type": "SOA" },
Learn more about how to use ed here: http://www.gnu.org/software/ed/manual/ed_manual.html
source share