Question: filegrep In this task, you will implement a simplified version of the grep program in C, called filegrep . The usage syntax of filegrep will
filegrep
In this task, you will implement a simplified version of the grep program in C, called filegrep . The usage syntax of filegrep will be as follows filegrep PATTERN FILE Both command-line arguments are necessary. PATTERN is a string of characters. FILE is a name of a file in which search is performed. Note that, unlike grep, filegrep searches for the pattern literally as it is. In other words, you do not need to consider meta characters and regular expressions. Our test cases will only include patterns that contain alphanumeric characters The output of running the program using the above arguments must be exactly the same as running grep -n PATTERN FILE Note that the output should include line numbers. If less/more than two arguments are provided you must print the following message to stderr Usage: filegrep PATTERN FILE Moreover, if FILE is invalid, your program should print the same error that grep would print to stderr
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
