I have a data.txt file containing data like this

house # john
car # smith
boat # john

I need to remove from file data.txt , all rows having "# john" . I can load the file in array because it's a very big file and I receive a memory error.
Is there any way to remove all rows having "# john" in the file , without loading the file in array ?

Thank you