8 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
RHEL 5.8
I have a text file like below. I want to grep for a string and then print the next 4 lines including the line with the string I grepped for
For eg:
I want grep for the string HANS and then print the next 4 lines including HANS
$ cat someText.txt
JOHN
NATIONALITY:... (7 Replies)
Discussion started by: omega3
7 Replies
2. Shell Programming and Scripting
My current code is:
user@ubuntu:~/Desktop$ grep -e "\(packaged by\)\|\(employee\)\|\(file name\)\|\(Total Data (MB) Read\)\|\(Begin Time\)" log.txt
packaged by = Ron Mexico
employee = Michael Vick
file name = Mike_Vick_2011.bat
Total Data (MB) Read: 11.82
Begin Time: 6/13/2011... (8 Replies)
Discussion started by: chipperuga
8 Replies
3. Shell Programming and Scripting
Hi
I have this in my file
2011-04-18 15:32:11 system-alert-00012: UDP flood! From xxxxxx to yyyyyyyyyy, int ethernet0/2). Occurred 1 times.
2011-04-18 15:32:11 system-alert-00012: UDP flood! From xxxxxx to yyyyyyyyyy, int ethernet0/2). Occurred 1 times.
2011-04-18 15:32:11... (9 Replies)
Discussion started by: zorrox
9 Replies
4. UNIX for Dummies Questions & Answers
I just need to print value 12 digit number after the key *MI*. My big concern is the below lines are not fixed format or length so cant cut based on the position.
XSA*00**00**XZ*DA-Paper*30*942411167****MI*010001990802~AEE
XSA*00**00**ZZ*EA-aper*30*94169****MI*010001960802~SDRE*ER... (7 Replies)
Discussion started by: gunaah
7 Replies
5. Shell Programming and Scripting
Hi Guys,
I need to set the value of $7 to zero in case $7 is NULL. I've tried the below command but doesn't work. Any ideas. thanks guys.
MEM=`ps v $PPID| grep -i db2 | grep -v grep| awk '{ if ( $7 ~ " " ) { print 0 } else { print $7}}' `
Harby. (4 Replies)
Discussion started by: hariza
4 Replies
6. Shell Programming and Scripting
Hi all,
I need help in following scenario. I have a file with about 10,000 lines. There are several lines which have word "START" (all upper case) in them. I want to grep line with word "START" and then do the following
1. Print the line number having word "START"
2. Print the next 11 lines.
... (4 Replies)
Discussion started by: jakSun8
4 Replies
7. Shell Programming and Scripting
Hi,
I have a question on bash. Basically I would like to print a file name using bash. I am actually trying to grep a particular character in sequential files.
I have alot files such that a.txt, b.txt,c.txt...etc.
If I found a certain character, I would print that particular filename.
I... (5 Replies)
Discussion started by: ahjiefreak
5 Replies
8. Shell Programming and Scripting
suppose u have a file
ACFCFACCACARCSHFARCVJVASTVAJFTVAJVGHBAJ
another file
A
C
F
R
then output shud be
A= 9
C=7
F=3
R=2
Thanks (12 Replies)
Discussion started by: cdfd123
12 Replies
SNMPDELTA(1) Net-SNMP SNMPDELTA(1)
NAME
snmpdelta - Monitor delta differences in SNMP Counter values
SYNOPSIS
snmpdelta [ common options ] [-Cf] [ -Ct ] [ -Cs ] [ -CS ] [ -Cm ] [ -CF configfile ] [ -Cl ] [ -Cp period ] [ -CP Peaks ] [ -Ck ] [ -CT ]
AGENT OID [ OID ... ]
DESCRIPTION
snmpdelta will monitor the specified integer valued OIDs, and report changes over time.
AGENT identifies a target SNMP agent, which is instrumented to monitor the given objects. At its simplest, the AGENT specification will
consist of a hostname or an IPv4 address. In this situation, the command will attempt communication with the agent, using UDP/IPv4 to port
161 of the given target host. See snmpcmd(1) for a full list of the possible formats for AGENT.
OID is an object identifier which uniquely identifies the object type within a MIB. Multiple OIDs can be specified on a single snmpdelta
command.
OPTIONS
COMMON OPTIONS
Please see snmpcmd(1) for a list of possible values for COMMON OPTIONS as well as their descriptions.
-Cf Don't fix errors and retry the request. Without this option, if multiple oids have been specified for a single request and if the
request for one or more of the oids fails, snmpdelta will retry the request so that data for oids apart from the ones that failed
will still be returned. Specifying -Cf tells snmpdelta not to retry a request, even if there are multiple oids specified.
-Ct Flag will determine time interval from the monitored entity.
-Cs Flag will display a timestamp.
-CS Generates a "sum count" in addition to the individual instance counts. The "sum count" is the total of all the individual deltas
for each time period.
-Cm Prints the max value ever attained.
-CF configfile
Tells snmpdelta to read it's configuration from the specified file. This options allows the input to be set up in advance rather
than having to be specified on the command line.
-Cl Tells snmpdelta to write it's configuration to files whose names correspond to the MIB instances monitored. For example, snmpdelta
-Cl localhost ifInOctets.1 will create a file "localhost-ifInOctets.1".
-Cp Specifies the number of seconds between polling periods. Polling constitutes sending a request to the agent. The default polling
period is one second.
-CP peaks
Specifies the reporting period in number of polling periods. If this option is specified, snmpdelta polls the agent peaks number
of times before reporting the results. The result reported includes the average value over the reporting period. In addition, the
highest polled value within the reporting period is shown.
-Ck When the polling period (-Cp) is an increment of 60 seconds and the timestamp is displayed in the output (-Cs), then the default
display shows the timestamp in the format hh:mm mm/dd. This option causes the timestamp format to be hh:mm:ss mm/dd.
-CT Makes snmpdelta print its output in tabular form.
-Cv vars/pkt
Specifies the maximum number of oids allowed to be packaged in a single PDU. Multiple PDUs can be created in a single request. The
default value of variables per packet is 60. This option is useful if a request response results in an error becaues the packet is
too big.
EXAMPLES
$ snmpdelta -c public -v 1 -Cs localhost IF-MIB::ifInUcastPkts.3 IF-MIB::ifOutUcastPkts.3
[20:15:43 6/14] ifInUcastPkts.3 /1 sec: 158
[20:15:43 6/14] ifOutUcastPkts.3 /1 sec: 158
[20:15:44 6/14] ifInUcastPkts.3 /1 sec: 184
[20:15:44 6/14] ifOutUcastPkts.3 /1 sec: 184
[20:15:45 6/14] ifInUcastPkts.3 /1 sec: 184
[20:15:45 6/14] ifOutUcastPkts.3 /1 sec: 184
[20:15:46 6/14] ifInUcastPkts.3 /1 sec: 158
[20:15:46 6/14] ifOutUcastPkts.3 /1 sec: 158
[20:15:47 6/14] ifInUcastPkts.3 /1 sec: 184
[20:15:47 6/14] ifOutUcastPkts.3 /1 sec: 184
[20:15:48 6/14] ifInUcastPkts.3 /1 sec: 184
[20:15:48 6/14] ifOutUcastPkts.3 /1 sec: 184
[20:15:49 6/14] ifInUcastPkts.3 /1 sec: 158
[20:15:49 6/14] ifOutUcastPkts.3 /1 sec: 158
^C
$ snmpdelta -c public -v 1 -Cs -CT localhost IF-MIB:ifInUcastPkts.3 IF-MIB:ifOutcastPkts.3
localhost ifInUcastPkts.3 ifOutUcastPkts.3
[20:15:59 6/14] 184.00 184.00
[20:16:00 6/14] 158.00 158.00
[20:16:01 6/14] 184.00 184.00
[20:16:02 6/14] 184.00 184.00
[20:16:03 6/14] 158.00 158.00
[20:16:04 6/14] 184.00 184.00
[20:16:05 6/14] 184.00 184.00
[20:16:06 6/14] 158.00 158.00
^C
The following example uses a number of options. Since the Cl option is specified, the output is sent to a file and not to the screen.
$ snmpdelta -c public -v 1 -Ct -Cs -CS -Cm -Cl -Cp 60 -CP 60
interlink.sw.net.cmu.edu .1.3.6.1.2.1.2.2.1.16.3 .1.3.6.1.2.1.2.2.1.16.4
fi
SEE ALSO
snmpcmd(1), variables(5).
4th Berkeley Distribution 25 Jul 2003 SNMPDELTA(1)