Skip to main content

All Questions

Tagged with
1 vote
3 answers
244 views

How to tail continuously a log file that is being deleted and recreated?

I need to extract information from a log file that is deleted and recreated every time a program runs. After detecting that the file exists (again), I would like to tail it for a certain regexp. The ...
user2066480's user avatar
0 votes
1 answer
302 views

How to exit a FOR loop on detecton of "error" stream using TAIL

I have a "for" loop which passes the results to a file called "results" Occasionally an error stream is detected and the loop continues trying within the loop for a number of times ...
Leighton 's user avatar
0 votes
1 answer
1k views

Bash - "timeout" with tail issue

timeout 0.6s $(tail -f ./file.txt | grep -qA2 --line-buffered "detail: " | grep -E -- "$KeyNumbers") So timeout isn't functioning as intended with this. I want it to cancel if ...
Kai's user avatar
  • 3
0 votes
1 answer
2k views

run command after every line of grep output appears

I'm wanting to constantly monitor syslog and perform some computations after a regex pattern appears, and use the grep output in the command, as well as continue to monitor for new matching lines. The ...
john doe's user avatar
  • 956
0 votes
2 answers
3k views

monitor log files and take actions upon a certain entry

i want to do the following: tail -f some file { if newline matches/contains somestring ( perform action1; perform action2; ...; more actions) somestring2 ( ...
grrfield's user avatar
1 vote
2 answers
4k views

Slicing the output of grep in bash

I'm trying to read a line of text in bash using grep, piped to tail to get the final line of the file, and then slice the first three "words" (i.e. dividing them using space) of that line as elements ...
Henry Brice's user avatar
2 votes
1 answer
9k views

how do i redirect output from tailf & grep to a file [duplicate]

All I wanted is to grep for specific lines in an ongoing log and re-direct it to some file.. tailf log | grep "some words" Now, I want the above command output to get re-directed to some file in on-...
Gokul's user avatar
  • 1,071
44 votes
3 answers
120k views

Piping from grep to awk not working

I am trying to grep the ongoing tail of file log and get the nth word from a line. Example file: $ cat > test.txt <<EOL Beam goes blah John goes hey Beam goes what? John goes forget it Beam ...
Belmin Fernandez's user avatar