Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Tool to suppress lines where value=0 Post 302620735 by putter1900 on Monday 9th of April 2012 05:59:34 AM
Old 04-09-2012
Tool to suppress lines where value=0

Hello everyone,

Here's the problem, I have a list generated by this command;

Code:
watch -n 5 'iptables -nvL | grep "DROP"'

It generates output that looks like this (severely truncated for clarity)

Code:
Every 5.0s: iptables -nvL | grep "DROP"                                                                                                                
 9573  574K DROP       all  --  *      *       10.1.0.0/16        0.0.0.0/0
    0     0 DROP           all  --  *      *       192.168.0.0/16   0.0.0.0/0

#IP's changed to internal IP's for the example.

There are hundreds of lines in the output, and what I'd like to do is suppress any output where the value in column 1 ("pkts") is zero. Row 2 column 1 of the data shows a value of zero, and these are the lines I'd like to delete. In other words, only see lines where there IS activity. (watch runs every 5 seconds to give something approaching a realtime output)

Much reading in these forums seems to indicate awk is the answer, but if I pipe the results of the above command through awk like this:

| awk '$1 == 0' #remove any rows where the value in column one is zero

there is no output of any kind, which isn't exactly useful Smilie

Could anyone point out what I'm doing wrong please?

Regards & TIA,

putter

Last edited by putter1900; 04-09-2012 at 07:15 AM..
 

9 More Discussions You Might Find Interesting

1. Programming

Suppress last N lines printing

Hi, I want to know different ways of suppressing printing of last N lines. Can anyone help? Thanks, Sree (1 Reply)
Discussion started by: chakri400
1 Replies

2. Shell Programming and Scripting

Suppress awk warnings

Hello everyone, Sorry if this is a bit of an RTM thing, but I can't find any flags for suppressing warnings with awk and Googling (this site too) didn't yield much useful. Does anyone know how to suppress warnings? The warning I'm specifically trying to remove is one warning me that I'm... (1 Reply)
Discussion started by: kdelok
1 Replies

3. Shell Programming and Scripting

suppress unzip queries

hey i have piece of code working in solaris and same code i want to deploy it in linux but in solaris its not asking for queris but in linux it is !!!! COMMAND ==> unzip $test/alter.war -d $webclientHome/. OUTPUT==> In solaris it proceeds with following traces replace /aa/test.txt?... (4 Replies)
Discussion started by: crackthehit007
4 Replies

4. Shell Programming and Scripting

suppress the Connection text

Hi Guys, I am calling a function from my script. The function has to return only one value which is the year. But in the function, i am having connecting statement to the database. The connection information is coming along with the year variable. I want to suppress the connecting... (1 Reply)
Discussion started by: mac4rfree
1 Replies

5. Shell Programming and Scripting

how to suppress dd output?

I have to stop the output of dd from writing to terminal. Here is the command: sudo dd if=boot1h of="/dev/r$temp1" Here is the output: 2+0 records in 2+0 records out 1024 bytes transferred in 0.000804 secs (1273715 bytes/sec) I have tried >> log.txt but it doesn't work. Is there... (4 Replies)
Discussion started by: msf5042
4 Replies

6. UNIX for Dummies Questions & Answers

pine email tool suppress prompt to save read messages

Could somebody please advise about how to configure pine/alpine so that on exit it doesn't prompt me to save read messages? Thanks (3 Replies)
Discussion started by: LeoKSimon
3 Replies

7. Shell Programming and Scripting

Suppress Error Message

How can I suppress a error message being given by awk command in bash shell? (2 Replies)
Discussion started by: Prachi Gupta
2 Replies

8. Shell Programming and Scripting

How to suppress error in following command?

I have a file containing data in multiple columns. The colums are seperated by pipe (|). I need to extract information as below: myfile_20130929_781;10;100.00 where myfile.txt is the file name. 10 is the number of records in the file starting with 120 and 100.00 is the sum of 26th field of... (16 Replies)
Discussion started by: angshuman
16 Replies

9. Shell Programming and Scripting

Python: Suppress lines not substituted

Hi all, I started playing around with Python (2.6.6) trying to parse a file. No matter what I tried so far I am not able to print only the lines/group/backreference that have been affected by the substitution. Instead I get also the other lines too File to parse: some more text ... (2 Replies)
Discussion started by: zaxxon
2 Replies
DROP 
LANGUAGE(7) SQL Commands DROP LANGUAGE(7) NAME
DROP LANGUAGE - remove a procedural language SYNOPSIS
DROP [ PROCEDURAL ] LANGUAGE [ IF EXISTS ] name [ CASCADE | RESTRICT ] DESCRIPTION
DROP LANGUAGE removes the definition of a previously registered procedural language. You must be a superuser or the owner of the language to use DROP LANGUAGE. PARAMETERS
IF EXISTS Do not throw an error if the language does not exist. A notice is issued in this case. name The name of an existing procedural language. For backward compatibility, the name can be enclosed by single quotes. CASCADE Automatically drop objects that depend on the language (such as functions in the language). RESTRICT Refuse to drop the language if any objects depend on it. This is the default. EXAMPLES
This command removes the procedural language plsample: DROP LANGUAGE plsample; COMPATIBILITY
There is no DROP LANGUAGE statement in the SQL standard. SEE ALSO
ALTER LANGUAGE [alter_language(7)], CREATE LANGUAGE [create_language(7)], droplang(1) SQL - Language Statements 2010-05-14 DROP LANGUAGE(7)
All times are GMT -4. The time now is 11:38 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy