Within the /usr/share directory hierarchy, list the number of times the word 27 occurs in files in which it occurs at least once. Hint: Connect the output of one grep command to the input of another grep command using a pipe; the first grep command should display the count for all files in the hierarchy and the second should get rid of those with a count of 0.

What will be an ideal response?


$ grep -rwc 27 /usr/share | grep -v ':0$'
...
When you call grep with a list of files, the –c option causes grep to append
to each filename a colon (:) and the number of matches that occur in that
file. To satisfy this exercise, you must find all lines that do not end in :0 and
accept lines that end in numbers such as :20.
The second grep command uses the –v option to return all lines that do not
match the quoted regular expression (:0$). The $ matches the end of a line
(Sobell, page 1042). The single quotation marks are required to prevent the
shell from interpreting the dollar sign as a special character.

Computer Science & Information Technology

You might also like to view...

A __________ is a digital version of a dot pattern stored in memory.

a. floating-point nuber b. vector graphics image c. string d. bitmap or raster image

Computer Science & Information Technology

A file that contains organized data is called a data ________

A) merge B) file C) source D) master

Computer Science & Information Technology

Case-Based Critical Thinking QuestionsCase 7-1Ethan needs to create a design with a fluid layout for the Web page project in his sports marketing class. His older brother Maxwell already completed a similar project several years ago and is quite familiar with fluid layout design. Ethan asks him several questions to avoid making mistakes.Ethan is trying to use the max-width property with one of the following and it is not working. Which of the following is Ethan trying to use?

A. padding B. margins C. borders D. any of the above

Computer Science & Information Technology

An estimated duration appears with a(n) ____ after the duration.

A. pound sign B. exclamation point C. question mark D. red bullet

Computer Science & Information Technology