This question already has an answer here:
I have a log.txt file with various lines of strings and information.
I want to write a script to read the log.txt file line by line and any line that contains the word debug I want to put that line into a new file called debug.txt and all other lines should go to info.txt.
What is the best way to go about doing this? I tried to do a while loop but couldn't figure it out. Thanks