Hey All
Can any one please suggest the procedure to search a part of line in a very large file in which log entries are entered with very high speed.
i have trued with grep and egrep
grep 'text text text' <file-name>
egrep 'text text text' <file-name>
here 'text text text' is something which i have selected from file itself
tail -f thatlogfile | grep "text text text" > filteredlog
# or to see it on the screen and write it parallel into a file
tail -f thatlogfile | grep "text text text" | tee filteredlog
Thanks Zaxxon
Actually our requirement is to find a specific error line in a very lagre log file which is heavily appended with many log entries.
And on every occurenceof the error we have to sent a mail alert .
please suggest
Here is some idea to do this --
--------------------------------
ls -1 | while read record;do
rv=`echo $record | grep -w "ERROR-STRING"`
if [ $? -eq 0 ]
then
mailx -s "Error found in record - $record " xxxx@yourcompany.com
fi
done
Thanks all,
i have used
grep 'text to be searched' $myFile > test
as using tail -f $myFile | grep 'error'
im unable to set a exit condition.