There is this log file that data coming in is continuous. What I wanted to happen is to tail -f this log file then redirect it to a file with the ff conditions
example of the log files content
aaaaaaaaaaaaaaa bbbbbbbbbbbbbbb ccccccccccccccc ddddddddddddddd eeeeeeeeeeeeeee fffffffffffffff ggggggggggggggg hhhhhhhhhhhhhhh iiiiiiiiiiiiiii
in tailing, I want the redirection to start when it found the first pattern then stop the redirection as well as tailing when I found the second pattern. e.g
I want the redirection starts when it found pattern "ddddddddddddddd" then will stops when it found "hhhhhhhhhhhhhhh" the contents of the file created from redirection should be
ddddddddddddddd eeeeeeeeeeeeeee fffffffffffffff ggggggggggggggg hhhhhhhhhhhhhhh
In coding I'm thinking of something like this. But I don't have idea how to stop the redirection when it found the second pattern.
tail -f logfile > log.tmp while grep "ddddddddddddddd" log.tmp do cat log.tmp > logfile done