Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8068965
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T12:51:35+00:00 2026-06-05T12:51:35+00:00

Is it possible to change an element value in CSS via sh script in

  • 0

Is it possible to change an element value in CSS via sh script in unix? If so how would this been done?

Aim: I have an html site with multiple div boxes that are coloured based on alarming state, eg.. red, yellow, green.

I have an auto refresh for the HTML site, so all i want to do is to be able to add a line to my current sh scripts to change the css based on results to show the alarming state.

I was thinking using ‘sed’ as per below, but it needs to be element specific and not just change all reds to blues so to speak.

cat test.css | sed -e 's/RED/BLUE/' > test.css
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T12:51:36+00:00Added an answer on June 5, 2026 at 12:51 pm

    Give your element an id and add a line in the CSS for that id. Then, using sed, change that line.

    Say in the HTML the element looks like

    <element id="box123" ... / >
    

    and in the CSS this would get its color:

    #box123 { color: #000000; }
    

    then you change the color via changing the CSS using sed:

    $ sed -i 's/^#box123 { color: #000000; }/^#box123 { color: #0000ff; }/g' cssfile
    

    or shorter but with advanced sed methods:

    $ sed -i 's/^#box123\(.*\)#000000/^#box123\1#0000ff/g' cssfile
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

is it possible to change the value of an HTML attribute w/ CSS? I
Is it possible to change only Y value of background position in CSS? background-position-y
Is it possible to have a css style be aware of whether the element
Is it possible to change the name value of an input element? Here is
Is it possible to change the value of an <input type=text> that has been
I have this code : <script type=text/javascript> $(document).ready(function() { $('.trackInputHours').change(function() { $(this).closest('.trackOn').nextAll('.trackOn').find('.trackInputHours').val($(this).val()); }); });
Possible Duplicate: In PHP, how do you change the key of an array element?
Is it possible to change object's value not directly? For example a = {x:
Possible Duplicate: C++ STL set update is tedious: I can't change an element in
Possible Duplicate: C++ STL set update is tedious: I can't change an element in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.