UNIX shell script to search for most occurences of a keyword
Not what you're looking for?
Write a UNIX shell script that will search current directory for a text file that has the most occurrence of a given keyword, and display it on the terminal.
For example, if I want to search for a text file/script that contains the most number of for loop statements, and have it displayed on the screen, How would I do that?
Purchase this Solution
Solution Summary
Solution first gives a simple shell pipeline to achieve the goal and then shows how it can be put in a script form.
Solution Preview
Assuming single occurrence of search string (for example, "for") in a line, following simple pipeline will do the job.
grep -c "for" * | sort -nrt: +1 | head -1
Above pipeline command ...
Purchase this Solution
Free BrainMass Quizzes
Word 2010: Tables
Have you never worked with Tables in Word 2010? Maybe it has been a while since you have used a Table in Word and you need to brush up on your skills. Several keywords and popular options are discussed as you go through this quiz.
Basic UNIX commands
Use this quiz to check your knowledge of a few common UNIX commands. The quiz covers some of the most essential UNIX commands and their basic usage. If you can pass this quiz then you are clearly on your way to becoming an effective UNIX command line user.
Basic Computer Terms
We use many basic terms like bit, pixel in our usual conversations about computers. Are we aware of what these mean? This little quiz is an attempt towards discovering that.
Basic Networking Questions
This quiz consists of some basic networking questions.
Inserting and deleting in a linked list
This quiz tests your understanding of how to insert and delete elements in a linked list. Understanding of the use of linked lists, and the related performance aspects, is an important fundamental skill of computer science data structures.