helo need for data


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting helo need for data
# 1  
Old 01-23-2006
helo need for data

Dear All,

I am sorry i am posting again my question . Please help me rather than getting angry at me ...

I want to find out number of fails from different files ..

The files are generated in diffenent directories .The directories are created date wise .

Example :
/users/testsuite/appl/2006-01-20/
|------devel/
|-----via1/run.log
|-----via2/run.log


The file run.log contains fails . The fails record is started with ! .

I need output like this :

version :devel
via1 - 10 fails
via2 - 15 fails

version :9
sun : 5 fails
linux - 18 fails

pls help me to write this script

thanks in advance
# 2  
Old 01-23-2006
Paste sample of you input file.
# 3  
Old 01-23-2006
2006-01-23 05:48:47 #### Testsuite started
2006-01-23 05:48:49 (SiCat8_for_YRS: 1/526) Running daily/DB/CmdLn/CmdLn1.exp ...
2006-01-23 05:49:39 (SiCat8_for_YRS: 2/526) Running daily/DB/CmdLn/CmdLn2.exp ...
2006-01-23 05:49:42 (SiCat8_for_YRS: 3/526) Running daily/DB/CmdLn/CmdLn3.exp ...
2006-01-23 05:49:45 (SiCat8_for_YRS: 4/526) Running daily/DB/CmdLn/cliCS.exp ...
2006-01-23 05:49:47 (SiCat8_for_YRS: 5/526) Running daily/DB/CmdLn/comma.exp ...
2006-01-23 05:49:50 (SiCat8_for_YRS: 6/526) Running daily/DB/CmdLn/no_license.exp ...
2006-01-23 05:49:53 (SiCat8_for_YRS: 7/526) Running daily/DB/CmdLn/parfile.exp ...
2006-01-23 05:49:56 (SiCat8_for_YRS: 8/526) Running daily/DB/CmdLn/range.exp ...
2006-01-23 05:49:59 (SiCat8_for_YRS: 9/526) Running daily/DB/Filter/Filter1.exp ...
2006-01-23 05:50:02 (SiCat8_for_YRS: 10/526) Running daily/DB/SFM/SFMDoublePointHole.exp ...
2006-01-23 05:50:05 (SiCat8_for_YRS: 11/526) Running daily/DB/SFM/SFMDoublePointHole2.exp ...
2006-01-23 05:50:08 (SiCat8_for_YRS: 12/526) Running daily/DB/SFM/SFMDoublePointHull.exp ...
2006-01-23 05:50:11 (SiCat8_for_YRS: 13/526) Running daily/DB/SFM/SFMDoublePointHull2.exp ...
2006-01-23 05:50:15 (SiCat8_for_YRS: 14/526) Running daily/DB/SFM/SFMSelfIntersection.exp ...
2006-01-23 05:50:18 (SiCat8_for_YRS: 15/526) Running daily/DB/SFM/SFMSpeedAllAngleFlat.exp ...
2006-01-23 05:50:45 (SiCat8_for_YRS: 16/526) Running daily/DB/SFM/SFMSpeedManhatten.exp ...
2006-01-23 05:50:55 (SiCat8_for_YRS: 17/526) Running daily/DB/SFM/SFMThread.exp ...
2006-01-23 05:51:25 (SiCat8_for_YRS: 18/526) Running daily/DB/SFM/scanHoleConnect.exp ...
! 2006-01-23 05:51:28 (SiCat8_for_YRS) daily/DB/SFM/scanHoleConnect.exp: 2 fail(s).
2006-01-23 05:51:28 (SiCat8_for_YRS: 19/526) Running daily/DB/TechDB/load.exp ...
2006-01-23 05:51:31 (SiCat8_for_YRS: 20/526) Running daily/DB/TechDB/query.exp ...
2006-01-23 05:51:34 (SiCat8_for_YRS: 21/526) Running daily/DB/TechDB/remove.exp ...
2006-01-23 05:51:37 (SiCat8_for_YRS: 22/526) Running daily/DB/TechDB/save.exp ...
2006-01-23 05:51:40 (SiCat8_for_YRS: 23/526) Running daily/DB/area/area0.exp ...
2006-01-23 05:51:42 (SiCat8_for_YRS: 24/526) Running daily/DB/area/area1.exp ...
2006-01-23 05:51:45 (SiCat8_for_YRS: 25/526) Running daily/DB/area/area2.exp ...
2006-01-23 05:52:41 (SiCat8_for_YRS: 26/526) Running daily/DB/area/area3.exp ...
2006-01-23 05:53:14 (SiCat8_for_YRS: 27/526) Running daily/DB/area/area_text.exp ...
2006-01-23 05:53:18 (SiCat8_for_YRS: 28/526) Running daily/DB/attach/attach_density-insane.exp ...
2006-01-23 05:53:46 (SiCat8_for_YRS: 29/526) Running daily/DB/attach/attach_density.exp ...
2006-01-23 05:54:00 (SiCat8_for_YRS: 30/526) Running daily/DB/attach/attach_property-insane.exp ...
! 2006-01-23 05:54:04 (SiCat8_for_YRS) daily/DB/attach/attach_property-insane.exp: 4 fail(s).
2006-01-23 05:54:04 (SiCat8_for_YRS: 31/526) Running daily/DB/attach/attach_property.exp ...
! 2006-01-23 05:54:06 (SiCat8_for_YRS) daily/DB/attach/attach_property.exp: 2 fail(s).
2006-01-23 05:54:06 (SiCat8_for_YRS: 32/526) Running daily/DB/attach/attach_redundancy-insane.exp ...
2006-01-23 05:54:35 (SiCat8_for_YRS: 33/526) Running daily/DB/attach/attach_redundancy.exp ...
2006-01-23 05:55:16 (SiCat8_for_YRS: 34/526) Running daily/DB/bool/InternalMultiCrossing/hole_1.exp ...
# 4  
Old 01-23-2006
Quote:
Originally Posted by getdpg
version :devel
via1 - 10 fails
via2 - 15 fails

version :9
sun : 5 fails
linux - 18 fails
Does devel appear in your log file at all ?

See this

Code:
[/tmp]$ cat failure.ksh
#! /bin/ksh
#
TOTAL=0
FAIL=0
while read line
do
if [[ "$line" == *!* ]] ; then
FAIL=$(echo "$line" | sed -n -e 's_!.*: \([1-9][0-9]*\) fail.*_\1_p')
TOTAL=$(($TOTAL+$FAIL))
fi ;
done < failure.log

echo "$TOTAL fails"
[/tmp]$ ./failure.ksh 
8 fails
[/tmp]$

# 5  
Old 01-23-2006
Try this

Code:
#!/bin/ksh
num=`sed -n -e 's/^!.*$/&/p' xyz | sed 's/.*: \([0-9]*\) fail(s)./\1/'`
TOTAL=0
for i in $num
do
(( TOTAL = TOTAL + i )) 
done
print "Total number of failures is $TOTAL"

Code:
/export/home/test/mons>xyz.sh
Total number of failures is 8

# 6  
Old 01-23-2006
This will list you the number of failures in all the run.log files in all the directories from the current path

Code:
#!/bin/ksh
for j in `find . -name "run.log" -print`
do
TOTAL=0
num=`sed -n -e 's/^!.*$/&/p' $j | sed 's/.*: \([0-9]*\) fail(s)./\1/'`
for i in $num
do
(( TOTAL = TOTAL + i )) 
done
print "Total number of failures in $j is $TOTAL"
done

Code:
/export/home/test/mons>xyz.sh    
Total number of failures in ./UnixForum/run.log is 8
Total number of failures in ./run.log is 16

# 7  
Old 01-23-2006
Thanks for ur reply but iam getting error

I am getting error Total not found ..

Devel is directory .. inside that via1 and via2 is another directores which contains run.log ..

pls help
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

awk --> math-operation in data-record and joining with second file data

Hi! I have a pretty complex job - at least for me! i have two csv-files with meassurement-data: fileA ...... (2 Replies)
Discussion started by: IMPe
2 Replies

2. Shell Programming and Scripting

Parsing XML (and insert data) then output data (bash / Solaris)

Hi folks I have a script I wrote that basically parses a bunch of config and xml files works out were to add in the new content then spits out the data into a new file. It all works - apart from the xml and config file format in the new file with XML files the original XML (that ends up in... (2 Replies)
Discussion started by: dfinch
2 Replies

3. Shell Programming and Scripting

Converting variable space width data into CSV data in bash

Hi All, I was wondering how I can convert each line in an input file where fields are separated by variable width spaces into a CSV file. Below is the scenario what I am looking for. My Input data in inputfile.txt 19 15657 15685 Sr2dReader 107.88 105.51... (4 Replies)
Discussion started by: vharsha
4 Replies

4. Linux

Changeing helo sent from sendmail

I'm trying to change the helo sent from one of my sendmail servers. It is sending out localhost.localdomain and i need it to send , Every time i change it, my sendmail blows up. It wont send new mail and it gives me the error of Apr 13 17:19:03 localhost sendmail: o3E0J3F2012758: from=root,... (0 Replies)
Discussion started by: blackax
0 Replies

5. Shell Programming and Scripting

Extract data based on match against one column data from a long list data

My input file: data_5 Ali 422 2.00E-45 102/253 140/253 24 data_3 Abu 202 60.00E-45 12/23 140/23 28 data_1 Ahmad 256 7.00E-45 120/235 140/235 22 data_4 Aman 365 8.00E-45 15/65 140/65 20 data_10 Jones 869 9.00E-45 65/253 140/253 18... (12 Replies)
Discussion started by: patrick87
12 Replies

6. UNIX for Dummies Questions & Answers

helo sftp problem

helo I m creating new user and assigning them to group using my own binary. the entry for /etc/passwd file bhavin:x:2014:109:test:/home/pds_RBAC:/bin/false now when i access that user using sftp from the another linux pc for e.g sftp bhavin@148.147.165.46 passwd:- ****** but... (1 Reply)
Discussion started by: amitpansuria
1 Replies

7. UNIX for Dummies Questions & Answers

converting a tabular format data to comma seperated data in KSH

Hi, Could anyone help me in changing a tabular format output to comma seperated file pls in K-sh. Its very urgent. E.g : username empid ------------------------ sri 123 to username,empid sri,123 Thanks, Hema:confused: (2 Replies)
Discussion started by: Hemamalini
2 Replies

8. Red Hat

helo how to mount pendrive on redhat 9

helo my sysem is running on redhat 9. now i want to take data from redhat 9 pc to pen drive. but when i plug it it is not detected. can u tell me how to mount pendrive on redhat9. amit (1 Reply)
Discussion started by: amitpansuria
1 Replies

9. UNIX for Dummies Questions & Answers

Howto capture data from rs232port andpull data into oracle database-9i automatically

Hi, i willbe very much grateful to u if u help me out.. if i simply connect pbx machine to printer by serial port RS232 then we find this view: But i want to capture this data into database automatically when the pbx is running.The table in database will contain similar to this view inthe... (1 Reply)
Discussion started by: boss
1 Replies

10. UNIX for Dummies Questions & Answers

helo,every!

Hello,every one!I'm a new comer,and I'm form China.I have learnd UNIX only one year,so don't hesitate to point my error.Thank you…….! :p :p :p (4 Replies)
Discussion started by: main1984
4 Replies
Login or Register to Ask a Question