私は Linux を初めて使用し、プログラミングを知りません。しかし、いくつかのことを読むことで理解できるので、質問することができます.
私は以下のようなことをしています、
ファイルでいくつかの単語を見つけて、別のファイルでそれに応じてアクションを実行します。
find in log.txt
if "not found" 1 > notify.txt
if "reset by peer" 2 > notify.txt
if "Permission denied" 3 > notify.txt
if "Fetching" 0 > notify.txt
exit
お気に入り
if [it found] "not found" [text in the log.txt then it will write] 1 > notify.txt
if [it found] "reset by peer" [text in the log.txt then it will write] 2 > notify.txt
if [it found] "Permission denied" [text in the log.txt then it will write] 3 > notify.txt
if [it found] "Fetching" [text in the log.txt then it will write] 0 > notify.txt
スクリプトを書くのを手伝ってください。
notify.txt に 0 または 1 または 2 または 3 を書き込みたいとします。これで、スクリプトが何を書き込むかを決定します。スクリプトは、log.txt ファイルを読み取って決定します。
ありがとう