![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| delete lines containing a specific word in afile | sireesha9 | Shell Programming and Scripting | 4 | 02-23-2009 06:07 AM |
| how to display specific lines of a specific file | raidkridley | UNIX for Dummies Questions & Answers | 2 | 10-15-2008 03:46 PM |
| How to delete specific lines at the same time | zanetti321 | UNIX for Advanced & Expert Users | 1 | 03-24-2008 07:00 AM |
| Sed help to delete everything prior to WORD | drheams | Shell Programming and Scripting | 2 | 12-09-2005 05:34 PM |
| Delete specific lines in a text file | dniz | High Level Programming | 9 | 08-08-2005 09:30 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Delete lines prior to a specific date in a log file.
Hi all.
I have a database log file in which log data get appended to it daily. I want to do a automatic maintainence of this log by going through the log and deleting lines belonging to a certain date. How should i do it? Please help. Thanks. Example. To delete all lines prior to Jun 3. My content of my log is like below: Sun Jun 1 01:38:25 2008 Completed: ALTER DATABASE OPEN Sun Jun 1 22:00:40 2008 Thread 1 advanced to log sequence 2518 Current log# 1 seq# 2518 mem# 0: /u03/oradata/sbdevdb/redo01.log Current log# 1 seq# 2518 mem# 1: /u03/oradata/sbdevdb/redo04.log Mon Jun 2 10:00:33 2008 Thread 1 advanced to log sequence 2519 Current log# 2 seq# 2519 mem# 0: /u04/oradata/sbdevdb/redo02.log Current log# 2 seq# 2519 mem# 1: /u04/oradata/sbdevdb/redo05.log Mon Jun 2 22:01:10 2008 Thread 1 advanced to log sequence 2520 Current log# 3 seq# 2520 mem# 0: /u05/oradata/sbdevdb/redo03.log Current log# 3 seq# 2520 mem# 1: /u05/oradata/sbdevdb/redo06.log Tue Jun 3 01:30:03 2008 Starting background process EMN0 EMN0 started with pid=20, OS id=639158 Tue Jun 3 01:30:03 2008 Shutting down instance: further logons disabled Tue Jun 3 01:30:03 2008 |
|
||||
|
Hi. Thanks for the reply.
I tried and it did work to extract all logs after Jan 1. But I want the data from Jan 1 to remain in the original file. The command seems to only be able to pipe the output to another filename instead. Any other options? Thanks! |
|
||||
|
Hi all.
Vidhyadhar's reply did redirect all logs after Jan 1 to a new file. But, what i want is log data after Jan 1 to remain in my original file name. My original log filename is alert.log. I want alert.log to hold only data after Jan 1. Thanks. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|