I figured out how to read and message the contents of a file to a user that types a command, but how do you search a file for a specific line and delete it?
mdixon4az wrote:Exact. For example. !new.info would read the file and message the person that used that trigger each line of the file.
I want to be able to do !old.info and just cut & paste one of the lines after the trigger to get it to remove that line and resave the file.
Know how?
Thanks
I probably know how, but I don't know what '!new.info' would do...do you? If you want exact matches, why do you want the matches in return? a count would make more sense as you already know the contents of each matching line
read each line of the file, and increment a counter.
if counter != the specified line, copy the line to another file
when reached the end of file, delete the old file and rename the new as the old one...
Great, I will add that and test it out, make sure I don't mess something up. I would also like to add a search function, can you help me with that as well?
I have it basically working, only thing I have noticed if is that each time I use the command to find and remove a line from the file it adds an extra blank line to the new file. How can I get it to stop doing that?