I want to write the last ten lines which contain a spesific word such as "foo" in a file to a new text file named for instance boo.txt.

How can I achieve this in the command prompt of a unix terminal?

Edit
Report