remove contents including the tag if pattern matches

Hi all,

Can anyone help me on this. I have several WP sites that are affected by sql injections. But the contents are different as follows

western union india belgaum
western union india bolegaon
western union india barhaj
western union india budhana
western union india belda
western union india attayampatty (tn)
western union india biagdangdo
western union india avanashi

They are followed different url's. Is there any script that can be used to delete the contents in a tag including the tag if any of the pattern matches..

Suppose I am giving the pattern "india" in the script, the script have to delete the injected line with india including the tag from the database.

Can anyone help ?

Please post some input sample and desired output .

Here are another injected patterns

<a href=\"http://cialis-pharmacy-review.com\">Cialis</a>

<a href=\"http://cialis-pharmacy-review.com\">Cheap Cialis Super Active</a>

<a href=\"http://cialis-pharmacy-review.com\">Buy Cialis Super Active</a>

Database contents including the pattern

---------------------------------

<a title=\"Emotional Wealth Secret: Developing Emotional Awareness\" href=\"http://emotionalwealthacademy.com/ews-developing-emotional-awareness/\">Read and Download the Emotional Wealth Secret Fact Sheet: <a href=\"http://cialis-pharmacy-review.com\">Buy Cialis Super Active</a>

---------------------------------

My idea is creating a script and given the pattern "pharmacy" so that it will delete the line including the tags . From <a href=....................</a>

Check if this works.

 
perl -lne 'print if !/pharmacy/' te

What kind of database are you using? MySQL, Postgres, MSSQL, Oracle, ...?

Mysql

---------- Post updated at 07:32 AM ---------- Previous update was at 07:32 AM ----------

Thank you getmmg. That did it

Thanks again....

:slight_smile:

Pleasure :slight_smile: