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
IGAWK(1) Utility Commands IGAWK(1)
NAME
igawk - gawk with include files
SYNOPSIS
igawk [ all gawk options ] -f program-file [ -- ] file ...
igawk [ all gawk options ] [ -- ] program-text file ...
DESCRIPTION
Igawk is a simple shell script that adds the ability to have ``include files'' to gawk(1).
AWK programs for igawk are the same as for gawk, except that, in addition, you may have lines like
@include getopt.awk
in your program to include the file getopt.awk from either the current directory or one of the other directories in the search path.
OPTIONS
See gawk(1) for a full description of the AWK language and the options that gawk supports.
EXAMPLES
cat << EOF > test.awk
@include getopt.awk
BEGIN {
while (getopt(ARGC, ARGV, "am:q") != -1)
...
}
EOF
igawk -f test.awk
SEE ALSO
gawk(1)
Effective AWK Programming, Edition 1.0, published by the Free Software Foundation, 1995.
AUTHOR
Arnold Robbins (arnold@skeeve.com).
Free Software Foundation Nov 3 1999 IGAWK(1)