I am trying to grep the oracle erros evry day from the logs file. My problem is :
if i execute this command:
i am not getting the uniform result beacuse of the spaces inbetween. I aim id to get the current date , and then serach for grep ORA- CURRENTDATE log files .
Plz help.
Last edited by methyl; 04-05-2012 at 04:09 PM..
Reason: please use code tags
Quote:
Please post sample ORA- error lines from your log files (we need to see the "current date" format) and sample non-error lines. If you can, please include sample lines where the day-of-month is a single digit as well as those where the day-of-month is a double digit.
Please make it clear whether all these log files are in the same directory or whether there are subdirectories (I noticed your use of ls with the -r switch).
In my recollection Oracle logs contain all sorts of uninteresting ORA lines which are not errors. These logs however look like an Oracle custom application log, so let's assume that every ORA- line is an error.
Judging from the size of these logs you are probably not starting a new one each day (or each week, or each database restart, or whatever). Logs can become unmanageable if you don't archive them frequently - depends on local rules.
Please clarify whether you are trying to search logfiles with a unix directory timestamp of today's date, or looking through every logfile for error lines which contain today's date?
Last edited by methyl; 04-05-2012 at 05:05 PM..
Reason: typos
In principle it's relatively simple. It reads lines one by one, splits it into tokens, and runs the code you give it for each individual line. So '{ print $8 }' gets run for each individual line, printing the 8th column.
You can also tell it to run a code block only when a condition happens, like:
You can also use variables, and even arrays, and especially, associative arrays -- arrays which can use strings as indexes. A["slartibartfast"]=32; print A["slartibartfast"] would print 32 for instance.
You can have more than one code block which runs under different conditions. You could use this to find only unique values in a column:
And it's configurable, too. Usually, spaces and newlines are used to separate columns and lines, but it can use whatever you want instead! Lots of possibilities from a few simple rules.
P.S: $ is an operator, not a variable. $1 is column 1. You can also use it on a variable: N=5; print $N that would use the value of N to select column 5.
Hi All,
I am facing an issue while cutting fields with comma delimiter. There are many records with Double quotes in between.
My data: aaa,bbb,"ccc, ddd",eee,fff,"ggg ,hhh",iii
When i use cut command with comma delimiter, i am getting wrong data like
field1=aaa
field2=bbb
field3="ccc... (3 Replies)
Hi,
I'm writing a shell script and trying to grep a variable value, it works fine as long as there is a value in /tmp/list.out which is captured in $DSK but sometimes the file tends to be empty and that is where I'm having an issue while using grep which returns nothing. I know I can use something... (15 Replies)
Need help to append a pipe at end of the line immediately after the cut command,
I have an Input flat file with 16 feilds and I am removing the 16th feild by using the cut command as shown,
Input:
354|||||CORPORTATION||||NENE PARADE|||WISBECH|CAMBRIDGESHIRE|PE13 3BY|100001|
I... (5 Replies)
I am writing a shell script to skip couple of feilds in a flat file and as a part of this I have written the below piece of code in it.
cut -d '|' -f 1-17,19-31 $1 > filename
To add pipe at end of the line I used below command, but it adds even to header and footer as well which i... (11 Replies)
How am I supposed to print with one Unix command the names (and only the names) of company JMT? Problems with scandinavian letters? By typing
grep JMT url | egrep --only-matching ']+'I still have company name and + marks I should get rid of.
I'd be very grateful of your help bacause I am new... (1 Reply)
I have 2 files; one file (say, details.txt) contains the details of employees and another file (say, emp.txt) has some selected employee names. I am extracting employee details from details.txt by using emp.txt and the corresponding code is:
while read line
do
emp_name=`echo $line`
grep -e... (7 Replies)
i am using 'psu' to grep the status of a process like below :-
psu|grep -i agentf
29559 29552 0 00:53:05 ? 0:57 gn1avm_agent -n AGENTF1
28946 1 0 00:51:31 ? 0:31 gnavm_ewd -b gn1avm_agent -n AGENTF1 -c -n AGENTF1
29552 28946 0 00:53:05 ? 0:00 /bin/ksh... (6 Replies)
Hi,
I got a line of text which has spaces in between and it is a long stream of characters. I want to extract the text from certain position. Below is the line and I want to take out 3 characters from 86 to 88 character position. In this line space is also a character. However when using cut... (5 Replies)
not sure how to do it. wan't to delete it using cut and grep ince i would use it in the shell.
but how must the command be?
grep "64.233.181.103 wwwGoogle.com" /etc/hosts | cut -d
the delimeter is just a space. can you help meplease. :D (1 Reply)