dil_bert Posted January 28, 2018 Share Posted January 28, 2018 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? Quote Link to comment https://forums.phpfreaks.com/topic/306351-filter-out-certain-lines-of-a-big-data-set/ Share on other sites More sharing options...
kicken Posted January 28, 2018 Share Posted January 28, 2018 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. Quote Link to comment https://forums.phpfreaks.com/topic/306351-filter-out-certain-lines-of-a-big-data-set/#findComment-1555829 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.