The below command is not giving any result. I want to
grep the error line from the file and insert into table.
Command which is not working:
tail -f logfile.log | grep ERROR|while read msg; do psql -d testdb -c insert into t values('$msg'); done
But if I remove the
grep ERROR code from the command, it is working as expected. I am not sure what's going on?
Command which is working fine:
tail -f logfile.log|while read msg; do psql -d testdb -c insert into t values('$msg'); done
You can assume the below data in file:
ERROR sql committed ERROR ERROR error ...