Guidance needed for quick script


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Guidance needed for quick script
# 1  
Old 08-07-2008
Lightbulb Guidance needed for quick script

Hi all,

I am trying to get the exception count daily from a log file which is more than 1 GB in size.

I am using loops which get the count of the exception and transaction. But i need to take this exception count for a time frame from 5.00 am to 5:00 pm.

I Think I can use to exact the error message in the loop. But i can use the sed to exact all the exception to a temp log then i can grep to that temp log which will speed up my script. like this

sed -n s/: 5:/,/:17:/p exception.log >> temp/log -> i am not sure about the syntax i need to check this. Smilie

Awaiting for your expertise on this issue.

Also i want to search some of the exception like in a log file. For that i used to call the checker loop each and every time..Is that any method available where i can search and take the exact count for the the string.

This is the method

checker()
{
count=`grep -c "$2" $1`
if [ $count -eq 0 ]
then
echo "There is no exception in the log file" >> mail.log
echo $count
else
echo "There is $count exception happened" >> mail.log
echo $count
fi
}

I am calling like

E1=`check "temp.log" "Suspend Exception"`
E2=`check "temp.log" "DataException" `
.
.
total_exp= `echo "E1 + E2"|bc -l`
echo " total no of expection $total_exp"

this is a snipet from the script

Regards,
Senthil Kumar AK

Last edited by senthilkumar_ak; 08-07-2008 at 02:12 PM..
# 2  
Old 08-07-2008
Show us sample log entries so we can get the time check for you.
# 3  
Old 08-08-2008
Worker#1364lchalegreenVST: 10:02:11 336 ViewStatementBusinessLogic.validateRequestStatementService is unable to fulfil a request
Worker#0522keynotescriptCP: 21:59:47 899 CardProfileServiceAggregatorForCycleCut.getCardProfileData Exit
Worker#0522keynotescriptCP: 21:59:47 899 CardProfileServiceAggregatorForCycleCut.getCardProfileData Exit
Worker#0522keynotescriptCP: 21:59:47 899 CardProfileBusinessLogic.getCardProfile Time taken to get cardprofile is :::: 4.96 secs
Worker#0522keynotescriptCP: 21:59:47 900 CardProfileServiceBean.getCardProfile Exit
# 4  
Old 08-08-2008
# 5  
Old 08-08-2008
Yes we are trying to reduce the time of script by some logic, but the result is not know yet
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Guidance needed for a typical shell script with sql query

Hi , I have a txt file with contents like: 1234 2345 3456 7891 I need to write a script which takes input file as txt file..run a sql query for that number and place the output of query in another file.. select * from bus_event where acct_nbr='1234'( from input txt file) the query... (20 Replies)
Discussion started by: Rajesh Putnala
20 Replies

2. Shell Programming and Scripting

korn shell script guidance

Please look over my short comings during this line if questions. I have multiple lines in a file that look like, phycook 618722 1 76 12:15:13 pts/122 70:24 /4js/runtime2.02.10/lib/fglrun-bin initmenu.42r phycook 593484 1 65 12:15:18 pts/122 69:22... (3 Replies)
Discussion started by: juredd1
3 Replies

3. Shell Programming and Scripting

Quick help on 'awk' needed...!!

bash-2.05$ A=`cat /etc/group |awk -F':' '{if ($1$3$4 ==... (3 Replies)
Discussion started by: ak835
3 Replies

4. Shell Programming and Scripting

Quick Favour needed

Hi there, i currently dont have access to my linux machine and need to get these script files sent to someone. Can someone please create .sh files for me with the code that i have displayed below. It would be very very helpfull. There are 3 different scripts and it would be great if someone... (3 Replies)
Discussion started by: aLderzz
3 Replies

5. Shell Programming and Scripting

Notepad help needed easy quick question

TAKE A LOOK AT THE ATTACHED PICTURE. my goal is just to SELECT n DELETE Those lines : Dialogue: Marked=0,0:02:39.49,0:02:40.49,Default,NTP,0000,00 00,0000,!Effect, (without the text) take a look at that picture... the marked line... i just need ALL of these lines removed.. i managed... (3 Replies)
Discussion started by: mr_spidey
3 Replies

6. HP-UX

HP-UX 10.20 fbackup? restore help/guidance needed

Hello, We've recently had a multiple hardrive failure in our legacy HP9000. Now the drives are repaired and the filesystems are recreated, I went to restore the last of the database tables from our dds3 backup, but cannot. Here's what's going on: BTW, I'm an absolute novice w/ HP-UX The... (5 Replies)
Discussion started by: jastuart
5 Replies

7. Shell Programming and Scripting

A little guidance needed :)

Hi guys, I'm learning the ropes of BASH and am doing a few exercises to see if its sinking in but have gotten stuck on something I KNOW is looking at me right in the face but just isn't registering. I'm creating a script that needs to get specific strings from a line. So using the "ls -l... (9 Replies)
Discussion started by: shadow0001
9 Replies

8. Shell Programming and Scripting

Quick help needed in the Shell Script

Hiii, i have a doubt here-- I have to take backup of all the files inside directory dir(logs,tmp,corefiles) at the location $BackupLocation.i should take the backup of logs,tmp,corefiles inside the $BackupLocation directory and then remove the files and touch the files inside the directory... (1 Reply)
Discussion started by: namishtiwari
1 Replies

9. IP Networking

IP Address changes - Quick Help Needed.

We are running Solaris 9 and I have changed the IP address, Subnet Mask & Broadcast Address using ifconfig and have also changed the default gateway. How do I save these changes as I have bounced the box and it reverted back to the old IP Address settings. I am really new to UNIX and we... (4 Replies)
Discussion started by: gingerd2003
4 Replies
Login or Register to Ask a Question