Question: Print lines containing a matching substring Write a C program using system calls that takes a string and a file as arguments. This program should

Print lines containing a matching substring

Write a C program using system calls that takes a string and a file as arguments. This program should print out all lines of the file containing the given string. You can assume the string will not contain any special characters or regular expression syntax.

Print lines containing a matching substring Write a C program using system

Hint: As with the HEAD problem from last week, you should read the text line-by-line. However, you should only print a line if it contains the search term. If this program does not receive the correct number of arguments, or if it fails to open the given file, it should return errors. $ ./carberryGREP obligations apache.txt or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only $ ./carberryGREP Appalachia apache.txt $ ./carberryGREP Usage: ./carberryGREP term file $ ./carberryGREP word notfile Error opening file Expected behavior of your GREP

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!