Need to build a variant of the UNIX tool grep, taking in twoarguments. The
first argument is the file name, and the second argument is thesearch. It will look through a file,
line by line, to find a user specified term in the line. If theline contains the word, the line is
printed out. The search term will be a case-sensitive, singlealphanumeric string with no
whitespaces and at least one character. If the file does notexist or cannot be opened, print
“cannot open file” and exit.
For example, the current working directory contains 2 files:
test.txt and simple-grep (the executable of your program)
test.txt contains:
Lorem ipsum dolor sit
PayPal Gateway not configured
PayPal Gateway not configured