Parsing log files, displaying logs between specific dates


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Parsing log files, displaying logs between specific dates
# 8  
Old 03-06-2009
What is not working? sed or the date command?

What is your OS?
# 9  
Old 03-06-2009
i m on HP-UX

and it gives me

date: illegal option -- y
Usage: date [-u] [+format]
date [-u] [mmddhhmm[[cc]yy]]
date [-a [-]sss.fff]

in this line

LC_ALL=C date -d $dteIso +'%d %B %Y'

i hane understood this

dteIso=$(echo $dte | sed 's/\(..\)\(..\)\(....\)/\3\2\1/') and it gives o/p as

20090305

but now we have to convert this into

5 Mar 2009

please respond

thanks
haris
# 10  
Old 03-06-2009
Using bash or ksh

Code:
#!/bin/bash
dte=05032009
d=${dte:0:2}
m=${dte:2:2}
y=${dte:4:4}

arrMonth=(January February March April ...)

echo $d ${arrMonth[$m-1]} $y

# 11  
Old 03-06-2009
it gives an error

d=${dte:0:2}: bad substitution

thanks,
haris
# 12  
Old 03-06-2009
Depends on the shell you use. What's that shell?

I don't have a HP-UX machine to help you further.
# 13  
Old 03-06-2009
ripat,

pls dont put such

quotes

@ haris this is the third time you post the very same question on someone else's post. I have replied to your problem here:
Parsing log files, displaying logs between specific dates

first see to it that ur code works properly on HP-UX

i m not a mad guy nor i get pleasure by asking the same question
i want to be a part of this sight so dont do such things which might cost me
this is bcoz of u

Reason: Thread hijacking
-------

-------

This infraction is worth 2 point(s) and may result in restricted access until it expires. Serious infractions will never expire.

so pls i urge u not u put such responses if u cant help me or provide proper sol its ok
# 14  
Old 03-06-2009
haris,
Please read the rules of these Forums you agreed to previously.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Red Hat

Moving files with specific dates

Hi, These are the list of files in one directory in the server : # ls -lrt total 10120 -rw-r--r-- 1 root root 4484 Jul 8 2011 install.log.syslog -rw-r--r-- 1 root root 51890 Jul 8 2011 install.log -rw------- 1 root root 3140 Jul 8 2011 anaconda-ks.cfg drwxr-xr-x 2 root root... (2 Replies)
Discussion started by: anaigini45
2 Replies

2. Shell Programming and Scripting

Search for logs traced between specific date and time from log file

HI, I want to search for a logs which are trace between specific date and time from logs file. My logs are generated like this :- Tue Jun 18 05:00:02 EEST 2013 | file_check.sh| Message:script has files to process. Thu Jun 20 05:00:02 EEST 2013 | file_check.sh| Message:script has files to... (5 Replies)
Discussion started by: ketanraut
5 Replies

3. Shell Programming and Scripting

Redirect all logs files contents into a single log file

Hi , I have a Data cleansing process which creates different log file for each step , when the process runs it creates following log files in below order: p1_tranfrmr_log.txt p1_tranfrmr_stats.txt p2_globrtr_log.txt p2_globrtr_stats.txt p3_cusparse_log.txt p3_cusparse_stats.txt ' '... (8 Replies)
Discussion started by: sonu_pal
8 Replies

4. Debian

Logrotate truncated my log files to 0 bytes and no logs are written

Hi, Yesterday I installed and configured logrotate on my Debian machine. I was expecting this to run at 06:25 in the morning and it actually did. All my old logs were compressed and zipped but the new logs were all with size equal to 0 bytes. Processes, while still running ok, they were not... (2 Replies)
Discussion started by: pmatsinopoulos
2 Replies

5. UNIX and Linux Applications

Parsing Tuxedo Logs

Right now I am parsing Tuxedo logs to calculate response times for various services. I was hoping to find a log tool that had support for Tuxedo and would generate drill down html reports. ---------- Post updated at 02:35 PM ---------- Previous update was at 02:33 PM ---------- I just wanted... (0 Replies)
Discussion started by: Lurch
0 Replies

6. Shell Programming and Scripting

Help parsing logs maybe with menu and variables?

I would like to parse through some logs looking for things like exception or failed (grep -i failed). Ideal would be if it were in a menu format so someone without unix ability could just choose option 1 2 or 3 etc. If I could pass the hostname to a variable also that would be awesome, so someone... (5 Replies)
Discussion started by: taekwondo
5 Replies

7. UNIX for Dummies Questions & Answers

To find files with specific dates and cp another folder.

Hi all, We have an existing script: find /u03/oraprod/perpcomn/admin/out -type f -ctime +7 \ -exec cp {} "/u08/oraprod/backup/cout" \; Which is to find all files more than 7 days and copy to another folder. However I would like to only list files with Sep 29, and cp to another folder. ... (2 Replies)
Discussion started by: *Jess*
2 Replies

8. Shell Programming and Scripting

Parsing out the logs and generating report

My file will contain following(log.txt): start testcase: config loading ...... error XXXX ..... end testcase: config loading, result failed start testcase: ping check ..... error ZZZZZ ..... error AAAAA end testcase: Ping check, result failed I am expecting below output. ... (4 Replies)
Discussion started by: shellscripter
4 Replies

9. Shell Programming and Scripting

Getting list of all the log files between two dates

I need to get the list of all the log files for a particular duration, say between two dates,i.e I need to get the list of all the log files between date1 and date2.The two dates are entered by the user. The format of the log file is : /path_name/graph_name_20080801180308.log. I dont... (1 Reply)
Discussion started by: avishekp
1 Replies

10. Shell Programming and Scripting

reading files for specific dates

assume files are in a directory /data $ ls -ltr Just displaying Data and file name: 01/01/2004 file_3434_typea.dat 01/01/2004 file_3423_typea.dat 01/01/2004 file_3436_typea.dat 01/01/2004 file_3434_typeb.dat 01/01/2004 file_3423_typeb.dat 01/01/2004 file_3436_typeb.dat ... (3 Replies)
Discussion started by: siva_jm
3 Replies
Login or Register to Ask a Question