what command would you enter to list the lines where binary search might be call
ID: 3858210 • Letter: W
Question
what command would you enter to list the lines where binary search might be called? IN UNIX
HERE IS THE INFO GIVEN BY TEACHER
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.)
Help would be a prreciated
Explanation / Answer
The answer is as follows:
The following command will list all the files along with the lines having the function call to binarysearch function:
grep "binarysearch(" -R // The command should be executed in the source code directory
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.