I ran across this comment which stated that it is possible to access the text in the macOS Terminal scrollback:
Finding text in scrollback is a weakness of most terminal emulators; the only ones I know of that provide it are OS X Terminal and Terminator.
I've done some searching, but I have not had any luck finding anything online saying how this can be done.
The reason I ask is that I'm looking for possible solutions to this Stack Overflow question, and am investigating whether there is a way to get text from the most recently run command in the macOS Terminal.
For this specific use case, I'm hoping to find the line(s) that match a particular pattern, so I can extract the matching text and pass it to the open
command.
There were failing tests. See the report at: file:///path/to/parent-project/child-project-1/build/reports/tests/test/index.html
↓
open file:///path/to/parent-project/child-project-1/build/reports/tests/test/index.html
In short, how can I get the text of the Terminal scrollback? Bonus points if it's limited to just the ouptut of the last command, but I can make a workable solution to my problem if I can get the entire Terminal scrollback text.