Jump to content

Recommended Posts

hello dear folks - good day dear php-experts,

 

 

i have some lines of data - approximately 500 lines  - within this set of data i have some lines i want to filter out... - each line where the marker word "span" is contained:

'url': 'http:www.url1.com', 'the_firstname': 'Pope', 'lastname': 'of Rome', 'the email-adress': 'popeofrome@hotmail.com'
'url': 'http:www.url2.org', 'the_firstname': 'Ben', 'lastname': 'hur', 'the email-adress': 'ben@hotmail.com'
'url': 'http:www.url3.net', 'the_firstname': 'Ali', 'lastname': 'the champ', 'the email-adress': 'ali-thechamp0hotmail.de'
'url': 'http:www.url4.at', 'the_firstname': 'meetoo', 'lastname': 'youtoo', 'the email-adress': 'meetoo@hotmail.com'


'url': 'http:www.url5.at', 'the_firstname': 'spam', 'lastname': 'spam', 'the email-adress': 'spamadress@hotmail.com'

how to do that - how can i filter out each line which contains the word  spam?

 

 

Is there an appropiate way?

From the CLI, grep -v spam yourdata.txt would work, assuming no false positive matches against 'spam'

 

If you want to do it with PHP then load the data with file_get_contents and loop over it filtering out lines by matching with something like strpos, preg_match, etc.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.