December 23, 2024 11:09 am
To remove HTTP links from the files `AdsBlockList_user_edit.txt` and `AdsBlockList.txt`, you can use a script or regex approach. Here's a simple Python script example:
```python
import re
# Function to remove URLs
def remove_http_links(file_path):
with open(file_path, 'r', encoding='utf-8') as file:
content = file.readlines()
# Regex to match http and https links
pattern = re.compile(r'https?://\S+')
# Remove links and write back to the file
with open(file_path, 'w', encoding='utf-8') as file:
for line in content:
cleaned_line = pattern.sub('', line)
file.write(cleaned_line)
# Paths to your files
remove_http_links('AdsBlockList_user_edit.txt')
remove_http_links('AdsBlockList.txt')
```
This script reads each file, removes any line containing HTTP or HTTPS links using regex, and writes the cleaned content back to the files. Adjust the file paths as needed.
Citations:
[1] https://superuser.com/questions/1674907/how-to-make-the-urls-unclickable
[2] https://community.alteryx.com/t5/Alteryx-Designer-Desktop-Discussions/Data-Input-Tool-File-Formats-and-txt-files/td-p/895347
[3] https://sellers.guide/resources/blogs/tips-tricks-and-best-practices-for-using-ads-txt
[4] https://stackoverflow.com/questions/38804425/remove-urls-from-a-text-file
[5] https://community.coda.io/t/put-the-text-from-a-txt-file-into-a-column/39261
[6] https://community.brave.com/t/cant-add-custom-blocklists/463678
[7] https://unix.stackexchange.com/questions/677868/remove-https-characters-in-a-text-file
[8] https://community.opendronemap.org/t/gcp-txt-file-format/10010
[9] https://forum.netgate.com/topic/116346/iblocklist-how-to-add-my-ip-lists
[10] https://forum.keyboardmaestro.com/t/removing-embedded-links-from-rtf-document/28613