03-03-2008
SED/AWK Script to clear log file using timestamp?
I have a log file on our system which fills up with lines that have been timestamped, as follows....
[
03/03/2008 10:56:06:815] (ERROR) balance: continuing session to genapp02 : 18500
[
03/03/2008 10:56:06:820] (ERROR) balance: continuing session to genapp02 : 18500
[
03/03/2008 10:56:07:003] (ERROR) balance: continuing session to genapp02 : 18500
[
03/03/2008 10:56:07:032] (ERROR) balance: continuing session to genapp02 : 18500
[
03/03/2008 10:56:07:048] (ERROR) balance: continuing session to genapp03 : 18501
Is it possible to delete all lines in this file that are older than 28 days using SED/AWK in a script?
10 More Discussions You Might Find Interesting
1. UNIX for Advanced & Expert Users
Hai,
I have a program which updates the result in a log file, as the program runs 24*7,the size of log file keeps on increasing.
Can you help me with a shell command which will clear the content of a log file in use.
1) I tried tail -10 logfile > logfile ( the content is not changed )
2) >... (10 Replies)
Discussion started by: coolbhai
10 Replies
2. Shell Programming and Scripting
Hello. I should have asked this awhile ago but here is my situation. My task is to generate LOC for different directories. I have a text file that has dates in this format (01-Aug-2006). My task is to read each line and compare it to a branch date. Depending on the date, it should generate a... (0 Replies)
Discussion started by: mastachef
0 Replies
3. UNIX for Advanced & Expert Users
I'm trying to find a way to show large page sizes (page size in K) from multiple web server log files. Essentially I want to show only rows from a file where a specific column is larger than some value. Has anyone ever done this type of log analysis? If so, a snippet of code would be very... (2 Replies)
Discussion started by: mike_cataldo@ad
2 Replies
4. Shell Programming and Scripting
Hi,
I have logfile like this :
Actually the format is date format :
yyyymmddHHMMSS
and i want the log become this format
yyyy-mm-dd HH:MM:SS
for example
2009-07-19 11:46:52
Can somebody help me ?
Thanks in advance (3 Replies)
Discussion started by: justbow
3 Replies
5. Shell Programming and Scripting
If a log file is in the following format
28-Jul-10 ::: Log message
28-Jul-10 ::: Log message
29-Jul-10 ::: Log message
30-Jul-10 ::: Log message
31-Jul-10 ::: Log message
31-Jul-10 ::: Log message
1-Aug-10 ::: Log message
1-Aug-10 ::: Log message
2-Aug-10 ::: Log message
2-Aug-10 :::... (3 Replies)
Discussion started by: vikram3.r
3 Replies
6. Shell Programming and Scripting
Hi
I am dealing with the following string:
Date: Thur, 13 March 2011 01:01:10 +0000
I asked for help in another topic that converted a similar string:
Date: Thur, 13 March 2011 9:50 AM
To a 24 hr standard. The problem is that it comes out as:
Date: Thur, 13 March 2011 9:50:00 +0000... (4 Replies)
Discussion started by: duonut
4 Replies
7. Shell Programming and Scripting
I have this huge log file on my linux box that gets generated every day. I'm able to extract the information I need; however I really would like it to be broken down every 10mins.
Log File Snippet
01:23:45 MARYHADA Maryhadalittle.lamb(): fleece as white as snow 1394 for and everywhere that... (8 Replies)
Discussion started by: ravzter
8 Replies
8. Shell Programming and Scripting
I must go through some files to change a certain string within text files to another string. I use openSUSE and folders are mounted by cifs.
Text to be replaced (only in .m extension) is U:\FOLDER and new string is N:
That works fine with spaces in directory names etc., but this process ... (5 Replies)
Discussion started by: Pappa41
5 Replies
9. Shell Programming and Scripting
Hello Gurus,
First, i would like to know is there any way to solve my problem.
i have a log file like this:
INFO - ABCDRequest :: processing started for the record <0> TransactionNo <Txn#1> recordID <recID#1>
INFO - ABCDRequest :: processing started for the record <0> TransactionNo... (9 Replies)
Discussion started by: VasuKukkapalli
9 Replies
10. Shell Programming and Scripting
Hi All,
I need something where I could take the date from FILE1 and in this case the date is Thu Sep 10 13:48:42 EDT 2015 and I need it to match the closest PREVIOUS date in the log file FILE2 this means in this specific case it would be Thu Sep 10 2015 13:35:28.
I only need the closest... (3 Replies)
Discussion started by: roberto999
3 Replies
LAST(1) BSD General Commands Manual LAST(1)
NAME
last -- indicate last logins of users and ttys
SYNOPSIS
last [-n] [-h host] [-t tty] [user ...]
DESCRIPTION
Last will list the sessions of specified users, ttys, and hosts, in reverse time order. Each line of output contains the user name, the tty
from which the session was conducted, any hostname, the start and stop times for the session, and the duration of the session. If the ses-
sion is still continuing or was cut short by a crash or shutdown, last will so indicate.
-n Limits the report to n lines.
-h host Host names may be names or internet numbers.
-t tty Specify the tty. Tty names may be given fully or abbreviated, for example, ``last -t 03'' is equivalent to ``last -t tty03''.
If multiple arguments are given, the information which applies to any of the arguments is printed, e.g., ``last root -t console'' would list
all of ``root's'' sessions as well as all sessions on the console terminal. If no users, hostnames or terminals are specified, last prints a
record of all logins and logouts.
The pseudo-user reboot logs in at reboots of the system, thus ``last reboot'' will give an indication of mean time between reboot.
If last is interrupted, it indicates to what date the search has progressed. If interrupted with a quit signal last indicates how far the
search has progressed and then continues.
SEE ALSO
lastcomm(1), utmpx(5), ac(8)
HISTORY
Last appeared in 3.0BSD.
4th Berkeley Distribution June 6, 1993 4th Berkeley Distribution