LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   cutting down contents of text file (https://www.linuxquestions.org/questions/linux-newbie-8/cutting-down-contents-of-text-file-184086/)

kam_kenneth 05-21-2004 08:02 AM

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?

lyle_s 05-21-2004 08:08 PM

Can you use logrotate?

Lyle

kam_kenneth 05-22-2004 01:16 AM

I can't believe that skipped my mind. Thanks a lot :)!


All times are GMT -5. The time now is 03:50 AM.