1

I am dumping some debug info into a text file that I am using tail -f to monitor.

Is there a tool that I can then pipe that tail -f data into to be able to search the text on-screen using regular expression commands, like search in vim?

Jeff Schaller
  • 67,283
  • 35
  • 116
  • 255
Tegra Detra
  • 5,016
  • see if the answers in http://unix.stackexchange.com/questions/25211/is-there-a-way-to-make-tail-f-beep can do what you want. the OP there wanted it to alert, but there's an example using regexes to match and beep. you could use the same regex matching, and have your own action. – Tim Kennedy Jul 27 '13 at 05:57
  • not quite I want to be able to explore the data not highlight something specific. I have all this async stuff flying around so other then searching through the output its a shot in the dark to find what I want. – Tegra Detra Jul 27 '13 at 06:03

2 Answers2

7

Use less. Start less on the text file you want to monitor:

less some_file

If you want to search for a pattern, ues a slash to start a search a pattern:

/<pattern>  # forward search
?<pattern>  # backward search

If you want to filter the output use an ampersand:

&<pattern>

Then start the continuous output using shiftf. You can exit the continuous output display with ctrlc and refine or cancel your filter pattern or start a search.

Marco
  • 33,548
0

If you can't find anything else, you could try seetxt, which can monitor and update a loaded file at configurable intervals (1 second granularity), and has PCRE searching.

Unfortunately it does too many other things as well; I wrote it about 5 years ago and it was my first "big" C project; the source is pretty ugly, lol, but it generally works with some caveats that shouldn't affect what you are doing unless the input is very large or contains a lot of odd characters.

That said, it's something I'd think about revamping for exactly this purpose if it's a niche that lacks. I generally just stop/start things and deal with static logs when debugging, but something that streamed input and did regexps is a good idea.

goldilocks
  • 87,661
  • 30
  • 204
  • 262