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
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
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
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
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
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
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
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
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
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
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
LEARN ABOUT OSF1
uudemon.cleanu
uudemon(4) Kernel Interfaces Manual uudemon(4)
NAME
uudemon.admin, uudemon.cleanu, uudemon.hour, uudemon.poll - Administrative shell scripts for polling remote systems, cleaning up spool
directories, reporting status to the system administrator, and routine invocations of the uuxqt and uusched daemons
SYNOPSIS
These shell scripts reside in the following directory:
/usr/lib/uucp
DESCRIPTION
All the scripts can be run from the command line or can be run automatically by the cron daemon. To automatically run the scripts, remove
the comment character (#) from the beginning of the relevant line in the /var/spool/cron/crontabs/uucp file.
This script reports status to the system administrator. It issues the uustat command to find out the status of uucp jobs. It mails the
results to the uucp login ID. The script may be modified to send mail to any login ID such as the uucp administrative login ID (uucpa) or
root. This script cleans up the /var/spool/uucp and /var/spool/uucppublic directories by running the uucleanup command. The uucleanup com-
mand is run with the following parameters: -C7, -D7, X2, -o2, -W1. This script runs the uusched and uuxqt daemons in the background. This
script polls the systems listed in the /usr/lib/uucp/Poll file. The uudemon.poll script should be scheduled before the uudemon.hour
script. This allows uudemon.poll to create any command files before cron runs the uudemon.hour script.
FILES
Contains the uudemon.admin, uudemon.cleanu, uudemon.hour and uudemon.poll files. Contains the uucp file.
RELATED INFORMATION
Commands: cron(8), uucleanup(8), uusched(8), uuxqt(1)
Files: /usr/lib/uucp delim off
uudemon(4)