LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 05-21-2004, 08:02 AM   #1
kam_kenneth
Member
 
Registered: May 2004
Distribution: Fedora Core 2
Posts: 50

Rep: Reputation: 15
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?
 
Old 05-21-2004, 08:08 PM   #2
lyle_s
Member
 
Registered: Jul 2003
Distribution: Slackware
Posts: 388

Rep: Reputation: 52
Can you use logrotate?

Lyle
 
Old 05-22-2004, 01:16 AM   #3
kam_kenneth
Member
 
Registered: May 2004
Distribution: Fedora Core 2
Posts: 50

Original Poster
Rep: Reputation: 15
I can't believe that skipped my mind. Thanks a lot !
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sed Help Needed..Cutting out peice of file farmerjoe Programming 2 02-25-2005 06:05 PM
[bash] cutting text with sed Erhnam Programming 3 02-11-2005 04:31 AM
Java: Getting the contents of a search dialog box in text editor i am making ludeKing Programming 4 04-23-2004 08:46 PM
tar from contents of a text file trpn Linux - General 3 03-08-2004 01:05 AM
How to read and change the contents of a text file? Bassam Linux - General 11 02-26-2004 04:08 AM


All times are GMT -5. The time now is 09:33 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration