getdpg
January 24, 2006, 8:30am
1
hello all
Script and example of file
#!/bin/sh
#sh gdata.sh /users/testsuite/db/appl/
DATE=`date '+20%y-%m-%d'`
echo $DATE
for i in ${1}/$DATE/* ; do
find $i -name daily -prune -o -name run.log -print -exec grep -c ! {} \; done > test.log.
The test.log contains output like this
/users/testsuite/db/appl/2006-01-24/Devel/Sun/run.log
19
/users/testsuite/db/appl/2006-01-24/Devel/Linus/run.log
20
/users/testsuite/db/appl/2006-01-24/9/Sun/run.log
10
/users/testsuite/db/appl/2006-01-24/8/Sun/run.log
19
But i want to cut and format my file like this
Date : 2006-01-24
Version Host Fails
Devel Sun 19
Devel Linu 20
9 Sun 10
8 Sun 19
Please help me to modify this script . I have to show this staticts on web . Thanks a lot
$cat test.log | paste - - | tr "/" " " | cut -d" " -f7,8,10
Devel Sun 19
Devel Linus 20
9 Sun 10
8 Sun 19
getdpg
January 24, 2006, 8:51am
3
it is not working
error is cut :invalide delimiter ..
pls help me
can you copy and post what you have typed here....
space is a valid delimiter and cut can't say it as invalid delimiter...
it should work...
however try this...
cat test.log | paste - - | nawk 'BEGIN { FS="[/ ]" } { print $7,$8,$10 }'
getdpg
January 24, 2006, 9:01am
5
cat test.log |paste - - | tr "/""" | cut -d"" -f7,8,10 >newtest
i tried to only replace / with spaces that is also not working
can you please compare the statement what i have posted and what you have typed...
copy both the lines in notepad and compare character by character..
you will know what mistake you have done...
getdpg
January 24, 2006, 9:37am
7
sorry i didnt put space that's why it was giving me error
the first command is working..
but i am not getting number of failes .. because it is in second line ..
i am getting colunm 7 and 8 ..
can you tell me how to join the 2 lines..
i think i have to join first lines and then cut the data from file ..
pls write back
and thanks for helping me
I have included paste command to join lines and it works perfert to me,
I'm still worried what you are typing over there, I'm not interested in explaining how to type or copy/paste...
$ more test.log
/users/testsuite/db/appl/2006-01-24/Devel/Sun/run.log
19
/users/testsuite/db/appl/2006-01-24/Devel/Linus/run.log
20
/users/testsuite/db/appl/2006-01-24/9/Sun/run.log
10
/users/testsuite/db/appl/2006-01-24/8/Sun/run.log
19
$ cat test.log | paste - - | tr "/" " " | cut -d" " -f7,8,10
Devel Sun 19
Devel Linus 20
9 Sun 10
8 Sun 19
getdpg
January 24, 2006, 10:46am
9
yeah it is working paste command merge two lines
but when i am cuting the file it rake run.log and fails as one column ..
getdpg
January 24, 2006, 11:50am
10
Thanks a lot .. it is working
thanks mahendra and all