I have created a simple shell script where I print some output messages and I invoke a really long command which generates a very long log. I redirect the log generated by the command in a file named jobLog.log using this answer. So my code is this:
#!/bin/bash echo "Submiting a job to ...." sudo command_with_huge_output > jobLog.log 2>&1 && echo "Job ended! Log at jobLog.log"
I want to redirect one line from this log to the screen. When the job ends I use grep on the file like:
less jobLog.log | grep LineIwanttoFind
and this returns a line I am interested to print while the command is running. How can I filter the line I want, and redirect it in the screen while the command is running? Of course I also want to send the full log in jobLog.log file.
Thanks for any suggestion