With the UNIX command grep we can search in a file
for strings that match a given string. For example,
prompt> grep name file
will display on screen all lines in file that contain the string
name.
The function
void callgrep ( const char *string, const char *filename )
calls the grep command with as arguments
the actual content of the
variables string and filename.
Give the implementation of callgrep below :
void callgrep ( const char *string, const char *filename )
{
char *cmd;
sprintf(cmd, "grep %s %s", string, filename);
system(cmd);
}