cutting down contents of text file
Hi
I have a samba log running at the moment. I would like to use crontab to cut down so many lines each day to keep the file size down. Or I would like to delete entries that are a say, 1 week old. Here is part of the file...
ken@lnc99kk:/var/log/samba> cat log.smbd
.........................
[2004/05/21 08:09:21, 2] smbd/reply.c:reply_special(92)
netbios connect: name1=LNC99KK name2=SH03DACT
[2004/05/21 08:09:21, 2] smbd/reply.c:reply_special(111)
netbios connect: local=lnc99kk remote=sh03dact
[2004/05/21 08:09:31, 2] smbd/server.c:exit_server(511)
Closing connections
[2004/05/21 08:26:39, 2] smbd/reply.c:reply_special(92)
netbios connect: name1=LNC99KK name2=BLY00ILK
[2004/05/21 08:26:39, 2] smbd/reply.c:reply_special(111)
netbios connect: local=lnc99kk remote=bly00ilk
[2004/05/21 08:26:50, 2] smbd/server.c:exit_server(511)
Closing connections
[2004/05/21 09:00:00, 2] smbd/server.c:exit_server(511)
Closing connections
.........
I mean, i can cat | grep [date] and do something with that, but i am not sure how. Can anybody help?
|