UPPER 3 Posted August 9, 2023 Report Share Posted August 9, 2023 Hello everyone, I am looking for a way to remove lines (URLs) from a list that contains a specific word. Any help will be much appriciated. Thanks. Quote Link to post Share on other sites
Jaro 6 Posted August 10, 2023 Report Share Posted August 10, 2023 The following script creates a table, then puts it in a list so that we can loop through the lines. It removes every line that doesn't contain ,yes,yes. Then it simply creates a new table, this time with the updated list. clear all data create table from text(&Christians,"Name,Religion,Do you sometimes read The Bible?,Is Jesus the only way to Heaven? John,Christian,yes,no Bob,Christian,no,yes Stefanie,Christian,yes,yes Alena,Christian,yes,yes Suzan,Christian,no,no Rebecca,Christian,yes,yes Jessica,Christian,yes,yes Alex,Christian,yes,yes Franco,Christian,no,yes Benedict,Christian,yes,no Feona,Christian,yes,no Samantha,Christian,yes,yes") add list to list(%Christians,$list from text(&Christians,$new line),"Delete","Global") set list position(%Christians,0) loop while($comparison($list position(%Christians),"< Less than",$list total(%Christians))) { if($not($contains($next list item(%Christians),",yes,yes"))) { then { remove from list(%Christians,$subtract($list position(%Christians),1)) set list position(%Christians,$subtract($list position(%Christians),1)) } else { } } } create table from text(&REAL_Christians,"Name,Religion,Do you sometimes read The Bible?,Is Jesus the only way to Heaven? {%Christians}") Quote Link to post Share on other sites
UPPER 3 Posted August 12, 2023 Author Report Share Posted August 12, 2023 On 8/10/2023 at 2:48 PM, Jaro said: The following script creates a table, then puts it in a list so that we can loop through the lines. It removes every line that doesn't contain ,yes,yes. Then it simply creates a new table, this time with the updated list. clear all data create table from text(&Christians,"Name,Religion,Do you sometimes read The Bible?,Is Jesus the only way to Heaven? John,Christian,yes,no Bob,Christian,no,yes Stefanie,Christian,yes,yes Alena,Christian,yes,yes Suzan,Christian,no,no Rebecca,Christian,yes,yes Jessica,Christian,yes,yes Alex,Christian,yes,yes Franco,Christian,no,yes Benedict,Christian,yes,no Feona,Christian,yes,no Samantha,Christian,yes,yes") add list to list(%Christians,$list from text(&Christians,$new line),"Delete","Global") set list position(%Christians,0) loop while($comparison($list position(%Christians),"< Less than",$list total(%Christians))) { if($not($contains($next list item(%Christians),",yes,yes"))) { then { remove from list(%Christians,$subtract($list position(%Christians),1)) set list position(%Christians,$subtract($list position(%Christians),1)) } else { } } } create table from text(&REAL_Christians,"Name,Religion,Do you sometimes read The Bible?,Is Jesus the only way to Heaven? {%Christians}") Thank you so much Jaro! Quote Link to post Share on other sites
Jaro 6 Posted August 12, 2023 Report Share Posted August 12, 2023 You're welcome. Quote Link to post Share on other sites
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.