Sponsored Content
Operating Systems Linux SED/AWK Script to clear log file using timestamp? Post 302172254 by davesimm on Monday 3rd of March 2008 06:09:45 AM
Old 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?Smilie
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Clear log file in use.

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

Clear Case, Awk and script

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

WEB Server Log File Analysis using awk/sed/grep

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

Separate date timestamp use awk or sed command ?

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

Delete log file entries based on the Date/Timestamp within log file

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

Fix timestamp with Sed or Awk

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

Using SED/AWK to Summarize Log File in 10min Intervals

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

sed finds nothing but it changes file's timestamp

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

Help on Log File format using sed or awk

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

Bash Script Closest Timestamp (LOG FILE)

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
SESSION_ID(3)								 1							     SESSION_ID(3)

session_id - Get and/or set the current session id

SYNOPSIS
string session_id ([string $id]) DESCRIPTION
session_id(3) is used to get or set the session id for the current session. The constant SID can also be used to retrieve the current name and session id as a string suitable for adding to URLs. See also Session handling. PARAMETERS
o $id - If $id is specified, it will replace the current session id. session_id(3) needs to be called before session_start(3) for that purpose. Depending on the session handler, not all characters are allowed within the session id. For example, the file session handler only allows characters in the range a-z A-Z 0-9 , (comma) and - (minus)! Note When using session cookies, specifying an $id for session_id(3) will always send a new cookie when session_start(3) is called, regardless if the current session id is identical to the one being set. RETURN VALUES
session_id(3) returns the session id for the current session or the empty string ( "") if there is no current session (no current session id exists). SEE ALSO
session_regenerate_id(3), session_start(3), session_set_save_handler(3), session.save_handler. PHP Documentation Group SESSION_ID(3)
All times are GMT -4. The time now is 01:55 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy