Answer the question
In order to leave comments, you need to log in
How to find a new row in a MySQL table and output it to a text file using Bash?
There is a security alarm panel where all alarm events appear as new rows in a table in the MySQL database. How to organize the search for this new line and output it to a text file? Well, there, by means of telegram, on duty on mobile phones through crowns, it’s understandable :).
Answer the question
In order to leave comments, you need to log in
Well, this command will output the line with the maximum ID to the file:
mysql -u username -p 'password' -e 'SELECT * FROM table ORDER BY id DESC LIMIT 1' > output.txt
diff (event select) (old select)
or vice versa.
(grep and awk to taste)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question