I'm having a problem with sed and i can't figure it out, and i'm also amateur.
The objective of my code is to keep monitoring a file(OutputFile.dat) until possible strings(NaN or STOP) are found and then kill the program running on the background. It worked when I'd tried only one string. However when I'd tried to implement more possible matches the code didn't work out.
../program inputfile &> OutputFile.dat &
tail -f OutputFile.dat | sed -n '/NaN/q;/STOP/q'
killall program
I've tried a lot of different things but i can't figure this out. Alternative suggestions to achieve the same thing are also welcome.
Thanks in advance