Ksh - search for multiple strings and write lines to file


Any help would be greatly appreciated. I can read code and figure it out, but I have trouble writing from scratch.

I need help starting a ksh script that would search a file for multiple strings and write each line containing one of those strings to an output file.

If I use the following command:

$ grep "search pattern" file >> output file

...that does what I want it to. But I need to search multiple strings, and write the output in the order listed in the file.

Again... any help would be great! Thank you in advance!

Have a look at the regular expression manuals. You can specify multiple strings in the search expression such as grep "John|Bill"

Man grep will teach you a lot about regular expressions, but there are several online sites where you try them out, such as regex101 and (more colorful) regexr.