Quote:
Originally Posted by pixellany
Please confirm what you want to do---the "pseudocode" that you provided appears to say this:
in the file log.txt:
if the string "not found" is found, then write the numeral 1 to a file named notify.txt
OR...
did you mean that standard output should be redirected to notify.txt?
Also, did you intend that the file be written from the beginning, or should the data be appended to what is already there?
Finally, why GREP? I think this situation is better handled by some other utilities
|
I want to write in notify.txt 0 or 1 or 2 or 3.
Now script will decide what to write.
script will decide by reading log.txt file.
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
By this way I could create notification using notify.txt through edf.
About grep I will say that I know only this one thing.. If you can advice me something else then thanks a lot.
But I need to use that in .sh script so if you will advice me some thing else then you need to tell 2 things.
1. how to use that utility for this task.
2. what text could be in script.
Hop I could explain you properly on this time.
Thanks.