Sponsored Content
Top Forums Shell Programming and Scripting Check numeric fields greater than zero, and delete lines if appropriate Post 302370344 by Yorkie99 on Wednesday 11th of November 2009 07:08:26 AM
Old 11-11-2009
Thanks Franklin and radoulov

Both solutions work... but with a proviso... the log file contains similar lines but with the other types of errors seen on Cisco interfaces as well... and all these lines are deleted also. I just want to delete the lines I mentioned...

I'm guessing both solutions use a sort of 'delete everything else'. I just want 'delete line n and line n-1'

---------- Post updated at 07:08 AM ---------- Previous update was at 06:28 AM ----------

Since there's a start and end pattern to the section I want this to work on... I was thinking I might be able to nest awk's...

ie

Code:
awk '/start pattern/,/end pattern/ { awk '/input errors/ && ($2 + $5 + $9) > 0 {print s; print}{s=$0} }' infile

doesn't work though... I'm getting this error

Code:
bash: syntax error near unexpected token `{print'

Whats the correct syntax for this?
 

10 More Discussions You Might Find Interesting

1. Programming

check the given string is numeric or not.

Hi, how to check the given string is numeric or not , without converting ( using strtol...). for ex: if string is C01 - non-numeric data if string is 001 - numeric data TIA (11 Replies)
Discussion started by: knowledge_gain
11 Replies

2. Shell Programming and Scripting

Select lines in which column have value greater than some percent of total file lines

i have a file in following format 1 32 3 4 6 4 4 45 1 45 4 61 54 66 4 5 65 51 56 65 1 12 32 85 now here the total number of lines are 8(they vary each time) Now i want to select only those lines in which the values... (6 Replies)
Discussion started by: vaibhavkorde
6 Replies

3. Shell Programming and Scripting

How to check for a Numeric Value?

Using shell, I have a variable, how can I check that variable for a numeric value such as "41.0"? My program needs to do one things if the numeric value is found, and another if something else such as a string of letter is found. is there a specific character that denotes a numeral? The... (2 Replies)
Discussion started by: chagan02
2 Replies

4. Shell Programming and Scripting

Delete words greater than a specific length

HI All, I have a file with contents like this: apple computer terminal applecomputernetworkrouterterminalrouter network router applecomputernetworkrouterterminalrouter I want to remove all lines with length greater than "18 alphabets". Hence, my output should be: apple computer... (1 Reply)
Discussion started by: shoaibjameel123
1 Replies

5. Shell Programming and Scripting

search column and delete row if greater than value

Hi, as the title states i need to find a way to search a column for values great than 1000, and if it is, then delete that row. An example 1 7.021 6.967 116.019 4 U 6.980E+07 0.000E+00 e 0 0 0 0 2 8.292 7.908 118.063 3 U 1.440E+07 0.000E+00 e 0 821 814 ... (3 Replies)
Discussion started by: olifu02
3 Replies

6. UNIX for Dummies Questions & Answers

check if a decimal number is greater than zero

Hello, In my code I am checking to see if a variable that contains a decimal number is greater than 0 in the following manner: if do something fi However I am getting the error message (if $i for the current iteration holds 9.6352) command 9.6352 is not found How can I rectify... (5 Replies)
Discussion started by: Gussifinknottle
5 Replies

7. Shell Programming and Scripting

To perform sum aggregation on numeric fields

Hi all, I have following scenario to perform sum aggregation on certain columns Node Allocated_Space Pool_Name CS_Group Utilized Space -------- ---------------- ---------- --------- -------------- bdw1a_lun01 300 bdw_p0 ... (2 Replies)
Discussion started by: ckwan
2 Replies

8. Shell Programming and Scripting

Need to check the value greater than or less than and give out put to a file

HI, I have one file which is as below cat /var/tmp/test1 | awk '{ print $3}'|grep -v affected Data ---------- 200.4 . The above 200 value is changable by the database script. Now I need a script that checks the value 200.4 and the script shoud give out put if value is more than 225 (2 Replies)
Discussion started by: phani4u
2 Replies

9. How to Post in the The UNIX and Linux Forums

Very Urgent ---Need to delete the log files when the disk used% greater than 85% using df -k*

Hi, I am new to Shell scripts. I have an urgent requirement to find the disk space using "df -k". from that output,I need to check the used% whether greater than 85%. if it is greater than 85% then need to delete my log files. It is very urgent please some one help me. Thanks in Advance... (1 Reply)
Discussion started by: Anandbarnabas
1 Replies

10. Shell Programming and Scripting

Need to delete the log files when the disk used% greater than 85% using df -k

Hi, I am new to Shell scripts. I have an urgent requirement to find the disk space using "df -k". from that output,I need to check the used% whether greater than 85%. if it is greater than 85% then need to delete my log files. It is very urgent please some one help me. Thanks in Advance... (2 Replies)
Discussion started by: Anandbarnabas
2 Replies
mrinfo(8)						      System Manager's Manual							 mrinfo(8)

NAME
mrinfo - Displays configuration information from a multicast router SYNOPSIS
/usr/sbin/mrinfo [-d debug_level] [-r retry_count] [-t timeout_count] multicast_router OPTIONS
Sets the debug level. When the debug level is greater than 0 (the default), additional debugging messages are printed. Regardless of the debug level, if an error condition occurs, mrinfo writes an error message and terminates. Nonzero debug levels have the following effects: Prints packet warnings to stderr. Prints all level 1 messages and notifications of down networks to stderr. Prints all level 2 messages and notifications of all packet timeouts to stderr. Specifies the number of times to retry a neighbor query. The default is 3 retries. Specifies the number of seconds to wait for a neighbor to reply to a query. The default timeout is 4 seconds. DESCRIPTION
The mrinfo command displays the configuration information from the multicast router multicast_router. The mrinfo command sends the ASK_NEIGHBORS IGMP message to the specified multicast router. If the multicast router responds, the response includes the version number and a list of addresses for their neighboring multicast routers. If the responding router has a recent multi- cast version number, mrinfo requests additional information such as metrics, thresholds, and options from the multicast router. Once the specified multicast router responds, the configuration is displayed to the standard output. RESTRICTIONS
You must be superuser in order to run mrinfo. EXAMPLES
The following example shows the output of the mrinfo command where mbone.phony.dom.net is specified as the multicast router: mrinfo mbone.phony.dom.net 127.148.176.10 (mbone.phony.dom.net) [version 3.3]: 127.148.176.10 -> 0.0.0.0 (?) [1/1/querier] 127.148.176.10 -> 127.0.8.4 (mbone2.phony.dom.net) [1/45/tunnel] 127.148.176.10 -> 105.1.41.9 (momoney.com) [1/32/tunnel/down] 127.148.176.10 -> 143.192.152.119 (mbone.dipu.edu) [1/32/tunnel] For each neighbor of the queried multicast router, the IP address of the queried router is displayed, followed by the IP address and name of the neighbor. In square brackets, the metric (cost of connection) and the threshold (multicast ttl) are displayed. If the queried multi- cast router has a newer version number, the type (tunnel, srcrt) and status (disabled, down) of the connection are displayed. SEE ALSO
Commands: map-mbone(8), mrouted(8), mtrace(8) Networking: mbone.info(7) mrinfo(8)
All times are GMT -4. The time now is 07:25 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy