Sponsored Content
Top Forums Shell Programming and Scripting Delete row if both percentage values are equal to zero Post 302957708 by baris35 on Wednesday 14th of October 2015 06:45:14 AM
Old 10-14-2015
[solved] Delete row if both percentage values are equal to zero

Hello,

I have compiled a script but I have stucked at one point.
Each line contains two pcs of % value and what I want to do is to delete any line if both % values are zero.

data:
Quote:
ow1" class=alt1 onMouseOver='setupdateRow(1)' onMouseOut='setupdateRow(0)'><td><a href='/connector?id=1'>aaa.bbb.ccc.ee:10004</a></td><td><img src='/RU.gif' title='Russia'> aaa.bbb.ccc.ee</td><span style="float: right;">3%</span></td><td>561<span style="float: right;">10%</span></td></tr>
ow2" class=alt2 onMouseOver='setupdateRow(2)' onMouseOut='setupdateRow(0)'><td><a href='/connector?id=2'>xx.yy.zz.ee:5555</a></td><td><img src='/DE.gif' title='Germany'> xx.yy.zz.ee</td><span style="float: right;">45%</span></td><td>7304<span style="float: right;">10%</span></td></td></tr>
ow3" class=alt2 onMouseOver='setupdateRow(2)' onMouseOut='setupdateRow(0)'><td><a href='/connector?id=5'>aa.yy.zz.ee:3333</a></td><td><img src='/DE.gif' title='Germany'> aa.yy.zz.ee</td><span style="float: right;">0%</span></td><td>7304<span style="float: right;">0%</span></td></td></tr>
ow4" class=alt2 onMouseOver='setupdateRow(2)' onMouseOut='setupdateRow(0)'><td><a href='/connector?id=9'>hh.yy.zz.ee:4444</a></td><td><img src='/DE.gif' title='Germany'> hh.yy.zz.ee</td><span style="float: right;">22%</span></td><td>7304<span style="float: right;">0%</span></td></td></tr>
expected output:
Quote:
ow1" class=alt1 onMouseOver='setupdateRow(1)' onMouseOut='setupdateRow(0)'><td><a href='/connector?id=1'>aaa.bbb.ccc.ee:10004</a></td><td><img src='/RU.gif' title='Russia'> aaa.bbb.ccc.ee</td><span style="float: right;">3%</span></td><td>561<span style="float: right;">10%</span></td></tr>
ow2" class=alt2 onMouseOver='setupdateRow(2)' onMouseOut='setupdateRow(0)'><td><a href='/connector?id=2'>xx.yy.zz.ee:5555</a></td><td><img src='/DE.gif' title='Germany'> xx.yy.zz.ee</td><span style="float: right;">45%</span></td><td>7304<span style="float: right;">10%</span></td></td></tr>
ow4" class=alt2 onMouseOver='setupdateRow(2)' onMouseOut='setupdateRow(0)'><td><a href='/connector?id=9'>hh.yy.zz.ee:4444</a></td><td><img src='/DE.gif' title='Germany'> hh.yy.zz.ee</td><span style="float: right;">22%</span></td><td>7304<span style="float: right;">0%</span></td></td></tr>

ow3 should be deleted as both percentage value in related line are equal to zero.

Thanks in advance
Boris

Last edited by baris35; 10-14-2015 at 08:09 AM.. Reason: [solved]
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to calculate the percentage for the values in column

Hi, I am having the file which contains the following two columns. 518 _factorial 256 _main 73 _atol 52 ___do_global_ctors 170 ___main 52 ___do_g How can calculate the percentage of each value in the first column ? first need to get the sum of the first column and... (3 Replies)
Discussion started by: saleru_raja
3 Replies

2. Shell Programming and Scripting

How to insert data befor some field in a row of data depending up on values in row

Hi I need to do some thing like "find and insert before that " in a file which contains many records. This will be clear with the following example. The original data record should be some thing like this 60119827 RTMS_LOCATION_CDR INSTANT_POSITION_QUERY 1236574686123083rtmssrv7 ... (8 Replies)
Discussion started by: aemunathan
8 Replies

3. Shell Programming and Scripting

My Values are Equal but They are Not

Does anybody understand why this is not being interpreted as true. Script: #!/bin/bash errored=`grep "errored" new_update_scripts.txt` echo $errored = "errored" if ; then echo true else echo false fi Output: $ UpdateScripts errored = errored false (7 Replies)
Discussion started by: scottwmackey
7 Replies

4. UNIX for Dummies Questions & Answers

How to calculate the percentage/fraction of each value in a row against the maximum row value?

Hi, For each row in a file, i would like to identify the maximum value and calculate the percentage/fraction of the max for other values in the row. Then, I would like to print a copy of the file where values above a threshold are replaced with "1" and other values are left as "0". In the... (2 Replies)
Discussion started by: auburn
2 Replies

5. UNIX for Dummies Questions & Answers

Working out the percentage between two values

Hi there, I am totally new to Unix, I am trying to work out the percentage between two values in a ksh shell script and assign the result to a variable. Value1=577 Values2=244 So the calculation would be as follows: ((Value1 - Value2) / Value1) * 100 How would I be able to achieve... (2 Replies)
Discussion started by: NextLevelAndi
2 Replies

6. Shell Programming and Scripting

compare columns for equal values and output a summary

Hi all I am trying to scan a file that has 3 columns: red blue 123351 red blue 848655 red blue 126354 red blue 023158 black white 654896 red blue 650884 I want an output that sums the rows that have matching columns 1 and 2 :wall: red blue has 5 entries black white has 1 entry ... (4 Replies)
Discussion started by: reno
4 Replies

7. Shell Programming and Scripting

Keep 3 values in each row

Hi, I have n number of values like 1 2 3 4 I want the output like 1 2 3 4 5 6 - - - - - - Please help me on this:wall: (4 Replies)
Discussion started by: cns1710
4 Replies

8. Shell Programming and Scripting

addition of values in row

file content are like this sam,22,29,23,24,25,26,22 i want to add the values from column 3 (fix column no) to as per user input say up to column 8 (variable as per user) can we do this without using "awk" for each column (as number of columns are variable as per user input ) Thanks in... (5 Replies)
Discussion started by: sagar_1986
5 Replies

9. UNIX for Dummies Questions & Answers

Replacing values in a column if they equal a certain value

Hi, I have a tab delimited text file where some lines have the string "NA" in the second column. For these lines, I want to replace NA with the value in the first column, the symbol underscore followed by the value in the fourth column. How do I go about doing that? Thanks! Input: 1 ... (3 Replies)
Discussion started by: evelibertine
3 Replies

10. Shell Programming and Scripting

Deleting consecutive equal values in a file

Hello everyone, I have a requirement as shown below. I need to delete consecutive same values from the source file and give it as output file. Source: a,b,c,d,e,e,f,g Target: a,b,c,d,f,g The repeating value "e" should be deleted from the file completely. How can I achieve this... (14 Replies)
Discussion started by: vamsikrishna928
14 Replies
INSTALLSIEVE(1) 					      General Commands Manual						   INSTALLSIEVE(1)

 *

NAME
installsieve - user utility for managing sieve scripts SYNOPSIS
installsieve DESCRIPTION
installsieve is a utility that allows users to manage their sieve scripts kept on the server. OPTIONS
-v <name> View script with the given name. The script if retrieved sucessfully is output to standard output. -l List all of the scripts currently on the server. If one of the scripts is active a arrow is printed indicating that it is the active script. -p <port> Port to connect to. If left off this defaults to "sieve" as defined in /etc/services. -i <file> Install a file onto the server. If a script with the same name already exists on the server it is overwritten. Upon sucessfully putting the script on the server the script is set active. If <file> has the extension .script it is chopped when put on the server since sieve names may not contain a '.'. -a <name> Set <name> as the active script. The list of available names can be obtained from the '-l' option.. -d <name> Delete the sieve script on the server with <name>. -m <mechanism> Force installsieve to use <mechanism> for authentication. If not specified the strongest authentication mechanism is chosen. -g <name> Get the sieve script with <name> and save it to disk with a ".script" extension. If a file with that name already exists it is overwritten. -u <user> Userid/Authname to use for authentication; by default, the current user. CMU
Project Cyrus INSTALLSIEVE(1)
All times are GMT -4. The time now is 10:39 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy