Create a unix shell script for searches a text file


Discuss the below:

Q: Create a Unix shell script that searches for a text file with most occurrences of a given keyword. For instance, if I would like to search for a script with most usages of if statement, I would execute:

find_most_relevant.sh /home/student/myscripts if

The script find_most_relevant.sh should take two arguments. The first one is the directory where text files are located. The second argument is a keyword. The output of the script should either state:

No file with word found in the directory

Or

file : found X occurrences of word

(for the file with most occurrences of keyword only)

Solution Preview :

Prepared by a verified Expert
Programming Languages: Create a unix shell script for searches a text file
Reference No:- TGS01932191

Now Priced at $20 (50% Discount)

Recommended (99%)

Rated (4.3/5)