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

You are part of a team working on a large C++ program. The source code for this

ID: 3709506 • Letter: Y

Question

You are part of a team working on a large C++ 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.)

No one has gotten this right.. I need to use wildcards and cannot use -r , I need to use grep

Explanation / Answer

Hi Dear,

Please find my answer.

From the following command we will show the lines of code which include each call and the name of the file as of in which each such line occurs.

find ~cs252/Assignments/commandsAsst/project/ -type f -print0 | xargs -0 grep -H "binarySearch"

From the following command it will show that a list of the file names in which the function was mention

find ~cs252/Assignments/commandsAsst/project/ -type f -print0 | xargs -I {} -0 grep -l "binarySearch" "{}"

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