Delete a line from a textfile

madsem

Client
Регистрация
27.10.2011
Сообщения
66
Благодарностей
11
Баллы
0
How would I delete a line from a textfile? I know when I use the macro to get one line i can optionally delete it.

But for example I would like to have one big textfile with email addresses for all my templates, so I can re-use emails for sites I havent used them before. And let an email checker template run daily to check for banned email accounts, and then delete those from the file.

How would I do that?
 

madsem

Client
Регистрация
27.10.2011
Сообщения
66
Благодарностей
11
Баллы
0
Any idea how I could do that?

Check email, if email is invalid, delete line from file

Or also, how could I do this:
build in a check in my templates if an email address was already used to create an account on the site (if I make a template for only one single website for example)

I planned to create a txt file in a folder, where I save all email addresses I have used on this website, then in my template basically do this:

1. take email from file, if line exists in txt file #2 skip to next until one email is found that does not exist in txt file #2
2. register account
etc etc

Is there functionality in Zenno that allows me to do just that, or will I need to add some php code for example to my template for this?
 

Stereomike

Client
Регистрация
29.03.2011
Сообщения
221
Благодарностей
30
Баллы
0
Right now the easiest method would be your suggested steps. ZP can't access txt files like a database, so even if you found your string via regexp, you don't know the line and thus can't delete it right away.
I started moving my bigger projects to a more database driven approach. I save data (10.000s of entries) into csv and use csvfix (commandline tool) to process them (sorting, filtering, dupe remove, searching, deleting by string etc). That way ZP can drive a database. You have to create batch files for the commands (at runtime or pre-made) and then execute via 'own program' branch.
 

Кто просматривает тему: (Всего: 1, Пользователи: 0, Гости: 1)