change the background color if a number is less than a spacific number (html format)
Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
dears i have the folowing file which is called test.html:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<meta name="generator" content="SQL*Plus 12.2.0">
<style type='text/css'> body font:10pt Arial,Helvetica,sans-serif; color:black; background:White; p font:10pt Arial,Helvetica,sans-serif; color:black; background:White; table,tr,td font:10pt Arial,Helvetica,sans-serif; color:Black; background:#f7f7e7; padding:0px 0px 0px 0px; margin:0px 0px 0px 0px; th font:bold 10pt Arial,Helvetica,sans-serif; color:#336699; background:#cccc99; padding:0px 0px 0px 0px; h1 font:16pt Arial,Helvetica,Geneva,sans-serif; color:#336699; background-color:White; border-bottom:1px solid #cccc99; margin-top:0pt; margin-bottom:0pt; padding:0px 0px 0px 0px;-
h2 font:bold 10pt Arial,Helvetica,Geneva,sans-serif; color:#336699; background-color:White; margin-top:4pt; margin-bottom:0pt; a font:9pt Arial,Helvetica,sans-serif; color:#663300; background:#ffffff; margin-top:0pt; margin-bottom:0pt; vertical-align:top;</style><title>SQL*Plus Report</title>
</head>
<body>
<p>
<table border='1' width='90%' align='center' summary='Script output'>
<tr>
<th scope="col">
NAME
</th>
<th scope="col">
FREE_PERCENT
</th>
</tr>
<tr>
<td>
DG_BACKUP
</td>
<td>
50%
</td>
</tr>
<tr>
<td>
DG_DATA
</td>
<td>
96%
</td>
</tr>
<tr>
<td>
DG_INDEX
</td>
<td>
80%
</td>
</tr>
<tr>
<td>
DG_ORA
</td>
<td>
19%
</td>
</tr>
</table>
<p>
<br>
</body>
</html>
i want to find the values that are less than 20% and set the background for red:
<td bgcolor="red">
using sed or any other tool
Script I have tried so far.
number_of_lines_test=(`grep -n % test.html |sed -e '1d' |awk -F"[:%]" 'if ($2 <= 50) print $1'`)
for i in `seq 0 $(($#number_of_lines_test[@] - 1))`
do
sed -i -e "$(($number_of_lines_test[i] - 1))s/<td>/<td bgcolor="red">/" test.html
done
awk sed perl html
add a comment |Â
up vote
0
down vote
favorite
dears i have the folowing file which is called test.html:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<meta name="generator" content="SQL*Plus 12.2.0">
<style type='text/css'> body font:10pt Arial,Helvetica,sans-serif; color:black; background:White; p font:10pt Arial,Helvetica,sans-serif; color:black; background:White; table,tr,td font:10pt Arial,Helvetica,sans-serif; color:Black; background:#f7f7e7; padding:0px 0px 0px 0px; margin:0px 0px 0px 0px; th font:bold 10pt Arial,Helvetica,sans-serif; color:#336699; background:#cccc99; padding:0px 0px 0px 0px; h1 font:16pt Arial,Helvetica,Geneva,sans-serif; color:#336699; background-color:White; border-bottom:1px solid #cccc99; margin-top:0pt; margin-bottom:0pt; padding:0px 0px 0px 0px;-
h2 font:bold 10pt Arial,Helvetica,Geneva,sans-serif; color:#336699; background-color:White; margin-top:4pt; margin-bottom:0pt; a font:9pt Arial,Helvetica,sans-serif; color:#663300; background:#ffffff; margin-top:0pt; margin-bottom:0pt; vertical-align:top;</style><title>SQL*Plus Report</title>
</head>
<body>
<p>
<table border='1' width='90%' align='center' summary='Script output'>
<tr>
<th scope="col">
NAME
</th>
<th scope="col">
FREE_PERCENT
</th>
</tr>
<tr>
<td>
DG_BACKUP
</td>
<td>
50%
</td>
</tr>
<tr>
<td>
DG_DATA
</td>
<td>
96%
</td>
</tr>
<tr>
<td>
DG_INDEX
</td>
<td>
80%
</td>
</tr>
<tr>
<td>
DG_ORA
</td>
<td>
19%
</td>
</tr>
</table>
<p>
<br>
</body>
</html>
i want to find the values that are less than 20% and set the background for red:
<td bgcolor="red">
using sed or any other tool
Script I have tried so far.
number_of_lines_test=(`grep -n % test.html |sed -e '1d' |awk -F"[:%]" 'if ($2 <= 50) print $1'`)
for i in `seq 0 $(($#number_of_lines_test[@] - 1))`
do
sed -i -e "$(($number_of_lines_test[i] - 1))s/<td>/<td bgcolor="red">/" test.html
done
awk sed perl html
welcome to U&L, we are not a free scrpting service, what have you tried so far ?
â Archemar
Jun 25 at 11:10
actually i am new to scripting and i have thought of using sed the problem is after looping over the lines and check the value after using awk to cut the % sympol but how can i edit line before the matching reasults
â ammar
Jun 25 at 11:23
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
dears i have the folowing file which is called test.html:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<meta name="generator" content="SQL*Plus 12.2.0">
<style type='text/css'> body font:10pt Arial,Helvetica,sans-serif; color:black; background:White; p font:10pt Arial,Helvetica,sans-serif; color:black; background:White; table,tr,td font:10pt Arial,Helvetica,sans-serif; color:Black; background:#f7f7e7; padding:0px 0px 0px 0px; margin:0px 0px 0px 0px; th font:bold 10pt Arial,Helvetica,sans-serif; color:#336699; background:#cccc99; padding:0px 0px 0px 0px; h1 font:16pt Arial,Helvetica,Geneva,sans-serif; color:#336699; background-color:White; border-bottom:1px solid #cccc99; margin-top:0pt; margin-bottom:0pt; padding:0px 0px 0px 0px;-
h2 font:bold 10pt Arial,Helvetica,Geneva,sans-serif; color:#336699; background-color:White; margin-top:4pt; margin-bottom:0pt; a font:9pt Arial,Helvetica,sans-serif; color:#663300; background:#ffffff; margin-top:0pt; margin-bottom:0pt; vertical-align:top;</style><title>SQL*Plus Report</title>
</head>
<body>
<p>
<table border='1' width='90%' align='center' summary='Script output'>
<tr>
<th scope="col">
NAME
</th>
<th scope="col">
FREE_PERCENT
</th>
</tr>
<tr>
<td>
DG_BACKUP
</td>
<td>
50%
</td>
</tr>
<tr>
<td>
DG_DATA
</td>
<td>
96%
</td>
</tr>
<tr>
<td>
DG_INDEX
</td>
<td>
80%
</td>
</tr>
<tr>
<td>
DG_ORA
</td>
<td>
19%
</td>
</tr>
</table>
<p>
<br>
</body>
</html>
i want to find the values that are less than 20% and set the background for red:
<td bgcolor="red">
using sed or any other tool
Script I have tried so far.
number_of_lines_test=(`grep -n % test.html |sed -e '1d' |awk -F"[:%]" 'if ($2 <= 50) print $1'`)
for i in `seq 0 $(($#number_of_lines_test[@] - 1))`
do
sed -i -e "$(($number_of_lines_test[i] - 1))s/<td>/<td bgcolor="red">/" test.html
done
awk sed perl html
dears i have the folowing file which is called test.html:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<meta name="generator" content="SQL*Plus 12.2.0">
<style type='text/css'> body font:10pt Arial,Helvetica,sans-serif; color:black; background:White; p font:10pt Arial,Helvetica,sans-serif; color:black; background:White; table,tr,td font:10pt Arial,Helvetica,sans-serif; color:Black; background:#f7f7e7; padding:0px 0px 0px 0px; margin:0px 0px 0px 0px; th font:bold 10pt Arial,Helvetica,sans-serif; color:#336699; background:#cccc99; padding:0px 0px 0px 0px; h1 font:16pt Arial,Helvetica,Geneva,sans-serif; color:#336699; background-color:White; border-bottom:1px solid #cccc99; margin-top:0pt; margin-bottom:0pt; padding:0px 0px 0px 0px;-
h2 font:bold 10pt Arial,Helvetica,Geneva,sans-serif; color:#336699; background-color:White; margin-top:4pt; margin-bottom:0pt; a font:9pt Arial,Helvetica,sans-serif; color:#663300; background:#ffffff; margin-top:0pt; margin-bottom:0pt; vertical-align:top;</style><title>SQL*Plus Report</title>
</head>
<body>
<p>
<table border='1' width='90%' align='center' summary='Script output'>
<tr>
<th scope="col">
NAME
</th>
<th scope="col">
FREE_PERCENT
</th>
</tr>
<tr>
<td>
DG_BACKUP
</td>
<td>
50%
</td>
</tr>
<tr>
<td>
DG_DATA
</td>
<td>
96%
</td>
</tr>
<tr>
<td>
DG_INDEX
</td>
<td>
80%
</td>
</tr>
<tr>
<td>
DG_ORA
</td>
<td>
19%
</td>
</tr>
</table>
<p>
<br>
</body>
</html>
i want to find the values that are less than 20% and set the background for red:
<td bgcolor="red">
using sed or any other tool
Script I have tried so far.
number_of_lines_test=(`grep -n % test.html |sed -e '1d' |awk -F"[:%]" 'if ($2 <= 50) print $1'`)
for i in `seq 0 $(($#number_of_lines_test[@] - 1))`
do
sed -i -e "$(($number_of_lines_test[i] - 1))s/<td>/<td bgcolor="red">/" test.html
done
awk sed perl html
edited Jul 2 at 8:53
SivaPrasath
3,88611737
3,88611737
asked Jun 25 at 11:05
ammar
145
145
welcome to U&L, we are not a free scrpting service, what have you tried so far ?
â Archemar
Jun 25 at 11:10
actually i am new to scripting and i have thought of using sed the problem is after looping over the lines and check the value after using awk to cut the % sympol but how can i edit line before the matching reasults
â ammar
Jun 25 at 11:23
add a comment |Â
welcome to U&L, we are not a free scrpting service, what have you tried so far ?
â Archemar
Jun 25 at 11:10
actually i am new to scripting and i have thought of using sed the problem is after looping over the lines and check the value after using awk to cut the % sympol but how can i edit line before the matching reasults
â ammar
Jun 25 at 11:23
welcome to U&L, we are not a free scrpting service, what have you tried so far ?
â Archemar
Jun 25 at 11:10
welcome to U&L, we are not a free scrpting service, what have you tried so far ?
â Archemar
Jun 25 at 11:10
actually i am new to scripting and i have thought of using sed the problem is after looping over the lines and check the value after using awk to cut the % sympol but how can i edit line before the matching reasults
â ammar
Jun 25 at 11:23
actually i am new to scripting and i have thought of using sed the problem is after looping over the lines and check the value after using awk to cut the % sympol but how can i edit line before the matching reasults
â ammar
Jun 25 at 11:23
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
1
down vote
Try this,
number=(`grep -n "^[0-1][0-9]" test.html | awk -F ':' 'a=$1-1;print a'`)
for i in $number[@]
do
sed -i "$i s/.*/<td bgcolor="red">/" test.html
done
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
Try this,
number=(`grep -n "^[0-1][0-9]" test.html | awk -F ':' 'a=$1-1;print a'`)
for i in $number[@]
do
sed -i "$i s/.*/<td bgcolor="red">/" test.html
done
add a comment |Â
up vote
1
down vote
Try this,
number=(`grep -n "^[0-1][0-9]" test.html | awk -F ':' 'a=$1-1;print a'`)
for i in $number[@]
do
sed -i "$i s/.*/<td bgcolor="red">/" test.html
done
add a comment |Â
up vote
1
down vote
up vote
1
down vote
Try this,
number=(`grep -n "^[0-1][0-9]" test.html | awk -F ':' 'a=$1-1;print a'`)
for i in $number[@]
do
sed -i "$i s/.*/<td bgcolor="red">/" test.html
done
Try this,
number=(`grep -n "^[0-1][0-9]" test.html | awk -F ':' 'a=$1-1;print a'`)
for i in $number[@]
do
sed -i "$i s/.*/<td bgcolor="red">/" test.html
done
answered Jun 25 at 18:43
SivaPrasath
3,88611737
3,88611737
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f451737%2fchange-the-background-color-if-a-number-is-less-than-a-spacific-number-html-for%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
welcome to U&L, we are not a free scrpting service, what have you tried so far ?
â Archemar
Jun 25 at 11:10
actually i am new to scripting and i have thought of using sed the problem is after looping over the lines and check the value after using awk to cut the % sympol but how can i edit line before the matching reasults
â ammar
Jun 25 at 11:23