11-02-2008
function check_log
{
awk '{$0=tolower($0)}
/error/{err++}
/fail/{fail++}
/msg/{msg++}
/unable/{unable++}
/unsuccess/{uns++}
END{ print("%s\n",err?"Error found":"Error not found")
print("%s\n",fail?"Fail found":"Fail not found")
print("%s\n",msg?"Msg found":"Msg not found")
print("%s\n",unable?"Unable found":"Unable not found")
print("%s\n",uns?"Unsuccess found":"Unsuccess not found")
}' logfile
i created like this but i got the error for the lines in bold
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
I'm writing a small script thats purpose is to validate a single command line argument to make sure it is an integer. Also acceptable are a leading "+" or "-", but no more than one.
Example: "5" "-2" "+4" are all valid
If its invalid I simply print out a message saying so, otherwise I... (2 Replies)
Discussion started by: FuzzyNips
2 Replies
2. Shell Programming and Scripting
How can i make something like
if (echo "$arg2" | egrep -s '^+\.+km/h+$|^+km/h+$'); then
not to output the value of $arg2 on the screen, evertime i get match it outputs the value of the variable on the screen which i don't need to do. I know for grep its -q option but it doesn't work for egrep.... (2 Replies)
Discussion started by: Vozx
2 Replies
3. UNIX for Dummies Questions & Answers
Hi I've been searching google and have not found what egrep -c means. Does anyone know where I can get a cheat sheet or what that -c means?
thanks,
Linda (2 Replies)
Discussion started by: leelm
2 Replies
4. UNIX for Dummies Questions & Answers
HI,
I want to grep the contents of fileb from filea.
filbeb
5x4xxx371x31a43
4x40x037103a049
3x4x003710a0659
4x4x0x371a50912
filbea
5x4xxx371x31a43 3266000225
4x4003266000277 3266000277
4x400326x000499 3266000499
4x4003266000676 3266000676
4x4x0x371a50912 3266000777... (4 Replies)
Discussion started by: krao
4 Replies
5. Shell Programming and Scripting
Hello,
Why is this not returning files containing the string in the var $files?
files=`ls /dir1/dir_level2/dir_level3 | egrep "catch \["`
files=`ls /dir1/dir_level2/dir_level3` this by itself returns a list of files which I thought could be sent through grep or egrep to look for matches.
... (5 Replies)
Discussion started by: gio001
5 Replies
6. UNIX for Dummies Questions & Answers
Hi Guys,
we have a shell script which basically query the Database which retrieves huge data and use the data with "egrep" .
Now there is some data which contains characters like "abc)" and the same is used like below :
"egrep (.+\|GDPRAB16\|GDPR/11702 96 abc)\|$ temp.txt"
now while... (7 Replies)
Discussion started by: sagarjani
7 Replies
7. UNIX for Dummies Questions & Answers
HI,
I have two files filea, fileeb
filea
z283110z67
xx65686377
xx654681zz
xx652836xx
xx653881zz
xx65480z11
xx654z5466
xx65510000
xx65670000
xx656z0000
xx656z1822
fileb (3 Replies)
Discussion started by: krao
3 Replies
8. AIX
Hello,
On Aix 5.2, we changed the parameters tcp_keepinit, tcp_keepintvl and tcp_keepidle with the no command.
tunrestore -R is present in inittab
in the directory /etc/tunables we can clearly see the inclusion of parameters during reboot, including the file lastboot.log
... (0 Replies)
Discussion started by: dantares
0 Replies
9. Shell Programming and Scripting
Hi,
I am wondering if it's possible to link multiple patterns with egrep.
Here here is what I am doing :
grep -v ";;" | grep -v ARC_TIME | grep -v \* | grep -v STAS0 Can I do all of this by invoking egrep just once ?
Thanks (4 Replies)
Discussion started by: Aswex
4 Replies
10. Shell Programming and Scripting
hi,
i'm using egrep -i to search thru some text files for keywords (also stored in a file).
egrep does wildcard search aka %keyword%
as long as the keyword is found, it will be spool to a file
meaning if keyword is 'xyz'
123 aabgdggjxyzslgj
124 xyzgjksgjd
returns
123... (8 Replies)
Discussion started by: bing
8 Replies
LEARN ABOUT CENTOS
ipc::msg
IPC::Msg(3pm) Perl Programmers Reference Guide IPC::Msg(3pm)
NAME
IPC::Msg - SysV Msg IPC object class
SYNOPSIS
use IPC::SysV qw(IPC_PRIVATE S_IRUSR S_IWUSR);
use IPC::Msg;
$msg = IPC::Msg->new(IPC_PRIVATE, S_IRUSR | S_IWUSR);
$msg->snd($msgtype, $msgdata);
$msg->rcv($buf, 256);
$ds = $msg->stat;
$msg->remove;
DESCRIPTION
A class providing an object based interface to SysV IPC message queues.
METHODS
new ( KEY , FLAGS )
Creates a new message queue associated with "KEY". A new queue is created if
o "KEY" is equal to "IPC_PRIVATE"
o "KEY" does not already have a message queue associated with it, and "FLAGS & IPC_CREAT" is true.
On creation of a new message queue "FLAGS" is used to set the permissions. Be careful not to set any flags that the Sys V IPC
implementation does not allow: in some systems setting execute bits makes the operations fail.
id Returns the system message queue identifier.
rcv ( BUF, LEN [, TYPE [, FLAGS ]] )
Read a message from the queue. Returns the type of the message read. See msgrcv. The BUF becomes tainted.
remove
Remove and destroy the message queue from the system.
set ( STAT )
set ( NAME => VALUE [, NAME => VALUE ...] )
"set" will set the following values of the "stat" structure associated with the message queue.
uid
gid
mode (oly the permission bits)
qbytes
"set" accepts either a stat object, as returned by the "stat" method, or a list of name-value pairs.
snd ( TYPE, MSG [, FLAGS ] )
Place a message on the queue with the data from "MSG" and with type "TYPE". See msgsnd.
stat
Returns an object of type "IPC::Msg::stat" which is a sub-class of "Class::Struct". It provides the following fields. For a description
of these fields see you system documentation.
uid
gid
cuid
cgid
mode
qnum
qbytes
lspid
lrpid
stime
rtime
ctime
SEE ALSO
IPC::SysV, Class::Struct
AUTHORS
Graham Barr <gbarr@pobox.com>, Marcus Holland-Moritz <mhx@cpan.org>
COPYRIGHT
Version 2.x, Copyright (C) 2007-2010, Marcus Holland-Moritz.
Version 1.x, Copyright (c) 1997, Graham Barr.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
perl v5.16.3 2013-03-04 IPC::Msg(3pm)