Friday, May 3, 2024
4
rated 0 times [  4] [ 0]  / answers: 1 / hits: 2848  / 3 Years ago, thu, july 1, 2021, 11:46:20

I want to search and cut text from command output in a terminal so I can use it in subsequent command line invocations or just in an editor session.



Is there any way to easily run a regular expression against the output of a terminal and cutting results without touching the mouse?



My requirements are:




  • it should work while working with remote machines through ssh. In those machines I can not install extra software there so the solution must be local.

  • if possible, it must be "always present". For instance, if I'm running a long process and suddenly it fails I'd like to be able to grep through the output without having to start the process again with a prepared environment.


More From » command-line

 Answers
7

screen(1) allows you to copy/paste using the keyboard, but it requires that you run your shell/process inside screen.



To copy, hit Ctrl+A [, move the cursor (using the arrow keys) to the start point and hit (RETURN), move the cursor to the end point and hit . The marked text is now copied.



To paste, hit Ctrl+A ]



This solution also applies to Byobu, since Byobu is just a wrapper around screen.


[#37266] Friday, July 2, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
rvousnove

Total Points: 456
Total Questions: 130
Total Answers: 98

Location: El Salvador
Member since Sun, Sep 12, 2021
3 Years ago
;