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
class_admin(8)						      System Manager's Manual						    class_admin(8)

NAME
class_admin - Administer class scheduling and the database. SYNOPSIS
/usr/sbin/class_admin [subcommand] DESCRIPTION
The class_admin command is used to configure and control the class scheduler and to maintain its database /etc/class. The class_admin command can be run interactively or non-interactively. Non-interactive mode is useful when you would like to execute a single class_admin subcommand without user interaction. This allows class_admin to be run from within a script, which makes it easy to enable class scheduling at system startup through use of an init(8) script. To run class_admin non-interactively, specify a single class_admin subcommand as an argument when invoking class_admin. Interactive mode is useful when you would like to execute several class_admin subcommands. To run class_admin interactively, invoke class_admin without specifying a subcommand argument. Should the class scheduler database not exist, class_admin will automatically create one when it starts up. If the command is invoked non- interactively, a default database is created (using the following interactive defaults). The interactive process will require you to answer three questions: Shall processes that have not been explicitly assigned to a defined class be assigned to a "default" class? Enter (y/n) [n]: To be class scheduled, a process must be assigned to a class. If you answer <y> to this prompt, a special class called the "default" class will be created, and any process that has not been explicitly assigned to one of the defined classes will be assigned to this class. If you answer <n> to this prompt, then only those processes which have been explicitly assigned to a defined class will be class scheduled. Enforce class scheduling when the CPU is otherwise idle? (y/n) [n]: The administrator has the option of allowing classes to exceed their CPU percentage when the system is otherwise idle if yes is answered. Otherwise, classes are held to their allotted percentage even if the CPU has no other work. How often do you want the system to reset class usage? Enter number of seconds (2): Use a small number (several seconds) if there are interactive jobs subject to class scheduling to give them a quick response time. If only batch jobs are class scheduled, response time is not an issue and larger values may be used. If class scheduling is enabled, changes made take effect immediately. Subcommands Add a group or user to an existing class. If the group or user exists in another class, you will be asked if you want to move it or not. More than one group or user may be specified. Syntax: add <class name> <type> <id ... ...> <type> = 'gid' | 'uid' | 'session' | 'pgrp' | 'pid' Change the CPU percentage allotted to a class. The system will not allow the total of all classes to exceed 100%. Syntax: change <class name> <cpu %> Create a new class. The name must be unique. The newly created class will be empty. Use the add command to populate the class. Syntax: create <class name> <cpu %> Set up the basic class scheduling parameters. You will be prompted for each parameter. Syntax: configure Remove a group or user from an existing class. More than one group or user may be specified. Syntax: delete <class name> <type> <id ... ...> <type> = 'gid' | 'uid' | 'session' | 'pgrp' | 'pid' Destroy an existing class. If the class is not empty, you will be asked if it's OK to destroy it anyway. Syntax: destroy <class name> Turn off class scheduling for the system. Note that the kernel will terminate the class scheduler dae- mon. Syntax: disable Turn on class scheduling for the system. A daemon will be started that periodically examines class CPU usage and adjusts access of a class to the CPU depending on its percentage. Syntax: enable Return to the command shell. If any permanent changes were made to the database, You will be asked to save or dis- card them. (Same as `quit'). Syntax: exit On-line help. If a subcommand is specified, detailed information pertaining to that subcommand is displayed. Other- wise, a list of all subcommands and their arguments is displayed. Syntax: help [<subcommand>] Return to the command shell. If any permanent changes were made to the database, You will be asked to save or discard them. (Same as `exit'). Syntax: quit Change the name of an existing class. Syntax: rename <old name> <new name> Write permanent database changes to the disk and continue. Syntax: save List the configured classes, the CPU percentage allocated to each class, and members assigned to it. If no class name is specified, all classes will be shown. Syntax: show [<class name>] List the current CPU utilization of a class. If no class name is specified, all classes will be shown. Syntax: stats [<class name>] FILES
SEE ALSO
Commands: runclass(1), class_scheduling(4) class_admin(8)
All times are GMT -4. The time now is 04:08 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy