How to write to a file and, while the file is still being writen, read and parse its contents using
- by Isabelle
Hello.
I'm actually trying to write a shell script that logs the output of a command to a file but, since the command takes a long time to complete (about 15 minutes), I would like to start parsing the output of the command (content of the file) before the command is completed, so I can send messages to the standard output (the user), like:
10% complete
45% complete
and so on.
Program steps
Redirect command to a file: $(command) $FILE
Start reading and parsing the output ($FILE) before the command is finished.
I thought of using pararell programming, but I havent't got the hang of it.
Any help you be appreciated.
Best regards.