Find a string in specific column and then replace it new string in html file

I have html table with 4 columns with dates and No-Data values for some cells.

test02024-03-072024-03-072024-03-05 test12024-03-072024-03-07No Data test22024-03-062024-03-072024-03-07 test32024-03-072024-03-062024-03-06

For 2nd column and 3rd column:-

If 2024-03-07 is today's date then it should change "2024-03-07" and same for yesterday's date that it should change "2024-03-06"

For 4th column

If date is other than today or filled as "No Data", then it should replace as "2024-03-06" or No Data respectively.

Thanks in advance.

@sumayeka , Welcome.
Its important to note that the forum is a collaboration - requesters post challenge(s) faced along with their own code showing - where relevant inputs and expected outputs. It's vital that code written by you is shown along with its execution and messages/errors etc are shown, that way the team can see exactly what's going on and then come back with suggestions/fixes/solutions.

Your post needs to be cleaned up to fit that model (see end of this response) - i've effectively done that for you at the end of this response.
You also need to read faqs/guidelines on posting - use of markdown to separate code from dialog (these options are available along the top line of the dialog box you type requests into, simply hover your mouse over them to see what they do.

We would expect from your post, something like below as input !

What platform are you working on Windows?Linux(flavor)
Is this going to be done via a shell script or python program ? ....

#
# presume your raw data looks something like below - but am guessing
#
test	data1	data2	data3
test0	2024-03-07	2024-03-07	2024-03-05
test1	2024-03-07	2024-03-07	No Data
test2	2024-03-06	2024-03-07	2024-03-07
test3	2024-03-07	2024-03-06	2024-03-06

# and the 'html table' something like ?

<table>
  <tr>
    <th>test-number</th>
    <th>data1</th>    <th>data2</th>    <th>data3</th>
  </tr>
  <tr>
    <td>test0</td>    <td>2024-03-07</td>    <td>2024-03-07</td>    <td>2024-03-05</td>
  </tr>
  <tr>
    <td>test1</td>    <td>2024-03-07</td>    <td>2024-03-07</td>    <td>No Data</td>
  </tr>
  <tr>
    <td>test2</td>    <td>2024-03-06</td>    <td>2024-03-07</td>    <td>2024-03-07</td>
  </tr>
  <tr>
    <td>test3</td>    <td>2024-03-07</td>    <td>2024-03-06</td>    <td>2024-03-06</td>
  </tr>
</table>

is this homework ? (which is fine , but, declare it as so if it is)

1 Like