Search a file for "ORA-" with timestamp


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Search a file for "ORA-" with timestamp
# 1  
Old 06-04-2013
Search a file for "ORA-" with timestamp

Hi Team,

An application logfile is exists. From that logfile have to search for ORA- errors. Have to search with time bases. Please help me how to search a file with timestamp.

Regards,
Indu
# 2  
Old 06-04-2013
what kind of files? and you want to search it on the imestamp in file name or the time at which file is generated?
# 3  
Old 06-04-2013
Search a file for "ORA-" with timestamp

Hi,

It's .log Everyone hour once my script will search for ORA- error in that file. The script has to search in that file from where it is left out(from the timestamp).

Thanks & Regards,
Indu

Last edited by indira_s; 06-04-2013 at 09:30 AM..
# 4  
Old 06-04-2013
This is simple to do, but if you post some of the log file we can help you with it.
Here are some to help you:
Code:
data_1h=$(awk '$0>=from && $0<=to' from="$(date +%b" "%e" "%H:%M:%S -d -1hour)" to="$(date +%b" "%e" "%H:%M:%S)" /var/log/syslog)

This store last hour of
Code:
syslog

into a variable data_1h
Then you can search for data like this: echo data_1h | grep ORA
# 5  
Old 06-04-2013
Search a file for "ORA-" with timestamp

Hi Jotne,

I want to pick the ORA- errors and put it other logfile with the count(how many times same errors occur in that logfile). Every one hour once that script as execute. Everyone hour it should not search the file from the first. The file has to search where it left from that point only it should start searching.

Please find the sample logfile.

Code:
Jan 15, 2003 5:02:12 AM Unexpected problem occured.
LBRunner#2: core.DBException: ORA-24381: error(s) in array DML
ORA-06512: at "abc123.TRF#PKG", line 75
ORA-06512: at line 2
at core.Session.sqlPrepareExecute(Session.java:16)
at core.Session.sqlPrepareExecute(Session.java:178)
at core.Session.execute(Session.java:59)
---Original Exception---
java.sql.SQLException: ORA-24381: error(s) in array DML
ORA-06512: at "abc123.TRF#PKG", line 75
ORA-06512: at line 2
at com.services.xxx.yyy.transferELB(ALogDBImpl.java:48)
at com.services.xxx.yyy.transEventLogBuffer(ALogDBImpl.java:45)


Thanks & Regards,
Indu

Last edited by radoulov; 06-04-2013 at 09:34 AM..
# 6  
Old 06-06-2013
Hi All,

Please let me know any updates on this.

Regards,
Indu
# 7  
Old 06-06-2013
Its difficult to understand how you want it.
Post some kb of the logfile and desired output.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Search file containing ps results for a match "my.cnf" and then for a second match . "ok:" and

I need to find two matches in the output from ps. I am searching with ps -ef |grep mysql for: my.cnf /bin/sh /usr/bin/mysqld_safe --defaults-file=/data/mysql/master/agis_core/etc/my.cnf after this match I want to search back and match the hostname which is x number of lines back, above the... (2 Replies)
Discussion started by: bash_in_my_head
2 Replies

2. Shell Programming and Scripting

Bash script - Print an ascii file using specific font "Latin Modern Mono 12" "regular" "9"

Hello. System : opensuse leap 42.3 I have a bash script that build a text file. I would like the last command doing : print_cmd -o page-left=43 -o page-right=22 -o page-top=28 -o page-bottom=43 -o font=LatinModernMono12:regular:9 some_file.txt where : print_cmd ::= some printing... (1 Reply)
Discussion started by: jcdole
1 Replies

3. UNIX for Dummies Questions & Answers

Using "mailx" command to read "to" and "cc" email addreses from input file

How to use "mailx" command to do e-mail reading the input file containing email address, where column 1 has name and column 2 containing “To” e-mail address and column 3 contains “cc” e-mail address to include with same email. Sample input file, email.txt Below is an sample code where... (2 Replies)
Discussion started by: asjaiswal
2 Replies

4. Shell Programming and Scripting

Using a single "find" cmd to search for multiple file types and output individual files

Hi All, I am new here but I have a scripting question that I can't seem to figure out with the "find" cmd. What I am trying to do is to only have to run a single find cmd parsing the directories and output the different file types to induvidual files and I have been running into problems.... (3 Replies)
Discussion started by: swaters
3 Replies

5. Shell Programming and Scripting

grep with "[" and "]" and "dot" within the search string

Hello. Following recommendations for one of my threads, this is working perfectly : #!/bin/bash CNT=$( grep -c -e "some text 1" -e "some text 2" -e "some text 3" "/tmp/log_file.txt" ) Now I need a grep success for some thing like : #!/bin/bash CNT=$( grep -c -e "some text_1... (4 Replies)
Discussion started by: jcdole
4 Replies

6. Shell Programming and Scripting

awk command to replace ";" with "|" and ""|" at diferent places in line of file

Hi, I have line in input file as below: 3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL My expected output for line in the file must be : "1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL" Can someone... (7 Replies)
Discussion started by: shis100
7 Replies

7. UNIX for Dummies Questions & Answers

Explain the line "mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`"

Hi Friends, Can any of you explain me about the below line of code? mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'` Im not able to understand, what exactly it is doing :confused: Any help would be useful for me. Lokesha (4 Replies)
Discussion started by: Lokesha
4 Replies

8. Shell Programming and Scripting

Unix shell script (grep -A 6 -B 2 "ORA-" filename

BACKGROUND: I am using Solaris 10. Some of my boxes have gnu grep and I can use -A and -B flags on those. However, the solaris flavor of grep won't use the flags -A or -B. And some of my boxes won't be getting gnu grep. Should I try using perl, awk, or sed? Actual PROBLEM: I am... (7 Replies)
Discussion started by: el_guero
7 Replies

9. UNIX for Dummies Questions & Answers

grep/cat/more -- search in a txt file and display content from a specific "keyword"

Hi, I have a .txt file Sample: ===================== NEXT HOST ===================== AEADBAS001 ip access-list extended BLA_Incoming_Filter ip access-list extended BLA_Outgoing_Filter access-list 1 permit xxxxxxxxxxxxxx access-list 2 permit xxxxxxxxxxxxxx =====================... (4 Replies)
Discussion started by: I-1
4 Replies
Login or Register to Ask a Question