I'm not very familiar with UNIX's history, so take this with a grain of salt, but I believe it originates with the QED text editor. More specifically, with Ken Thompson's rewrite of the QED text editor, when he bequeathed it with an ed-like syntax. (Perhaps more accurate to say "when ed's ancestor began to look like ed".)
In Thompson's QED, much as with ed, the 'g' (aka "global") command's syntax is `g/regular expression/command`. It means "for every line (i.e., globally) matching regular expression, perform command". A common use was `g/re/p` to print matches, thus the now-familiar `grep` binary.
The /etc/glob binary is very similar in feel: `/etc/glob expression command`, which means "for every file matching expression, run command". (Note that the /etc/glob binary didn't return a list of files for the shell to deal with; it did all the command execution on its own.)
I can't pin down exactly when 'g' was added to QED. If we assume Thompson's first rewrite of QED had it, then 1967 might be a good guess. 1970 is the latest possibility, because that's when the only manual I can find[0] is dated. Note that it is for Ritchie's rewrite and mentions an "improved Global command", so it's definitely not the first appearance. There is some more history of QED and ed at [1].
In Thompson's QED, much as with ed, the 'g' (aka "global") command's syntax is `g/regular expression/command`. It means "for every line (i.e., globally) matching regular expression, perform command". A common use was `g/re/p` to print matches, thus the now-familiar `grep` binary.
The /etc/glob binary is very similar in feel: `/etc/glob expression command`, which means "for every file matching expression, run command". (Note that the /etc/glob binary didn't return a list of files for the shell to deal with; it did all the command execution on its own.)
I can't pin down exactly when 'g' was added to QED. If we assume Thompson's first rewrite of QED had it, then 1967 might be a good guess. 1970 is the latest possibility, because that's when the only manual I can find[0] is dated. Note that it is for Ritchie's rewrite and mentions an "improved Global command", so it's definitely not the first appearance. There is some more history of QED and ed at [1].
[0]: https://www.bell-labs.com/usr/dmr/www/qedman.html
[1]: https://www.bell-labs.com/usr/dmr/www/qed.html