Grep commands: need some practice help please

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!

  1. The problem statement, all variables and given/known data:
    Use the less command to view the words file.
    To see the results of a grep that returns many rows, pipe the output of the grep into less. For example, grep �the' words | less

You can pipe the output of a grep command into wc -l to count lines instead of displaying them.
How many words in this file begin with the letter x?
How many words in this file begin with the letter z?
How many words in this file begin with the letter x or z?

find or count the words in dictionary that:
end in ing (such as counting)
include ing but not at the end (such as ringing)
begin with a capital letter
contain only two letters, the first is lower case, the second uppercase (such as kW)
contain only the letters in simon in any order (such as osmosis)
begin with a vowel (aeiou)
do not contain a vowel (such as rhythm)
contain four consecutive vowels (such as queue)
are there any words with 5 consecutive vowels?
can be spelled using the 7 hex letters (such as faced)
contain all five vowels in the correct order a,e,i,o,u

  1. Relevant commands, code, scripts, algorithms:
    grep, less,pipes,egrep

  2. The attempts at a solution (include all code and scripts):

not sure how to do any of these

  1. Complete Name of School (University), City (State), Country, Name of Professor, and Course Number (Link to Course):
    UCOL Palmerston North, New zealand, Simon Burt, T111

Note: Without school/professor/course information, you will be banned if you post here! You must complete the entire template (not just parts of it).

Examples to think about. Try these command line experiments on your computer and see what happens:

echo Raining | grep ^R

What did you get after this experiment?

echo Raining | grep ^a

What did you get after this experiment?

echo Raining | grep ing$

What did you get after this experiment?

echo Raining | grep in$

What did you get after this experiment?

Read the manual page on grep by trying this on your computer:

man grep

What did you see after you did the experiment above?

Did you see any information that might help you with your homework tasks?

Did you see any examples at the end of the manual entry that might help you?

1 Like

You are perhaps not supposed to know that, but to show you that it pays off to come to unix.com for advice, here is how you might earn bonus points:

There is a way you can do that (counting that is) without using wc -l . You can find out how by carefully reading the man page of grep as Neo suggested.

You might also want to read this to get you started.

I hope this helps.

bakunin

thanks!