Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Need help with UNIX You are part of a team working on a large program. The sourc

ID: 3875667 • Letter: N

Question

Need help with UNIX
You are part of a team working on a large program. The source code for this program is kept in the directory ~cs252/Assignments/commandsAsst/project.
After a certain amount of debate, the team has decided to change the order of the parameters of the function binarySearch. Someone else is actually changing the definition of that function. Your job is to find all the places where that function is called and to make repairs as necessary.
What command would you give to list all calls to that function? You should show the lines of code containing each call and the name of the file from in which each such line occurs. (It’s OK to produce a few incidental uses of the function name as well, because you will be inspecting the output before actually making the changes.)

Same problem, but suppose that all you wanted was a list of the file names in which the function was mentioned?
Need help with UNIX
You are part of a team working on a large program. The source code for this program is kept in the directory ~cs252/Assignments/commandsAsst/project.
After a certain amount of debate, the team has decided to change the order of the parameters of the function binarySearch. Someone else is actually changing the definition of that function. Your job is to find all the places where that function is called and to make repairs as necessary.
What command would you give to list all calls to that function? You should show the lines of code containing each call and the name of the file from in which each such line occurs. (It’s OK to produce a few incidental uses of the function name as well, because you will be inspecting the output before actually making the changes.)

Same problem, but suppose that all you wanted was a list of the file names in which the function was mentioned?
Need help with UNIX
You are part of a team working on a large program. The source code for this program is kept in the directory ~cs252/Assignments/commandsAsst/project.
After a certain amount of debate, the team has decided to change the order of the parameters of the function binarySearch. Someone else is actually changing the definition of that function. Your job is to find all the places where that function is called and to make repairs as necessary.
What command would you give to list all calls to that function? You should show the lines of code containing each call and the name of the file from in which each such line occurs. (It’s OK to produce a few incidental uses of the function name as well, because you will be inspecting the output before actually making the changes.)

Same problem, but suppose that all you wanted was a list of the file names in which the function was mentioned?

Explanation / Answer

For the purpose as mentioned in the question, we can use the grep command in unix. grep searches in the named input files for lines that contain a match to the given pattern. Now , we need to find occurence of the word 'binarySearch' in all the filec contained in the directory ~cs252/Assignments/commandsAsst/project/ . The command would be as follows:

grep binarySearch ~cs252/Assignments/commandsAsst/project/*

* acts as a wildcard to point to any file in the given directory and subdirectories.

For printing the filenames only, we need a -l option along with the command. Thus the command becomes:

grep -l binarySearch ~cs252/Assignments/commandsAsst/project/*

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote