Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

6
  • 1
    My inner Unix greybeard says you should be using tools like grep to do this rather than relying on features of your terminal emulator.
    – Spiff
    Commented Oct 16, 2018 at 18:30
  • grep can't do dynamic filter like that and I can't afford to restart the process, should I just shut down the server? Makes no sense. I know what you are saying, but only an end-user application that actually displays the text can do this AFAICT. Commented Oct 16, 2018 at 18:30
  • 2
    Oh, so you have output in the terminal emulator's scrollback buffer that you can't regenerate? That's a bummer. You could always do Cmd-A, Cmd-C, pbpaste | grep somesearchstring.
    – Spiff
    Commented Oct 16, 2018 at 18:36
  • I guess I have to make a video to get it across. I can increase the buffer size to 100K lines which is more than enough. What I am trying to do - when I search for "fooxoaogeg" I only want the one line that matches that to show up in the terminal, then when I undo the filter, all the unmatched lines reappear on the screen. Commented Oct 16, 2018 at 19:16
  • 1
    I understand exactly what you want, but I don't know whether Terminal.app or iTerm2 provide a GUI way to do it (which is why I didn't post an Answer), so I provided a way to do something very similar in any terminal emulator. Namely: select all, copy, (optionally open a new window here), use the "pbpaste" command to send the pasteboard (clipboard) contents to stdout, pipe it to grep and have grep filter on your string or regex, (optionally close the new window here). It's not as sweet as what you want, but it might be a decent workaround.
    – Spiff
    Commented Oct 16, 2018 at 19:40