Log files

Hello,

I want to delete a logfile but not all the message in the log;

example,

wait
wait
wait
wait
hello
hello
hello
hello

so in the logfile i will delete only the text hello and the wait not.

grep -i wait /somepath/yourlogfile > /tmp/your-tmp-logfile
mv /tmp/your-tmp-logfile /somepath/yourlogfile

You may want to check ownership/permissions on the log file before and after to insure it's the same. If the log file is opened by a process, you may want to stop it before changing it (since you didn't really state what the log file is for... )

Thanks but this not where i`m looking for what i meen is a log file in that log file are serverall types of information and ill will only delete som wait or what i said. Example log file:
wait (Delete)
wait (Delete)
wait (Delete)
wait (Delete)
close (stay)
close (stay)
wait (Delete)
wait (Delete)

So only the wait errors delete

Then replace the -i option with -iv
grep -iv wait /somepath/yourlogfile > /tmp/your-tmp-logfile
mv /tmp/your-tmp-logfile /somepath/yourlogfile

This will change grep to get everything except lines with wait in them

Thkx this works for my self i`l got almost the same:
grep -v "^Wait$" file > file; mv file