Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
[intro_to_linux]$ grep -i bayes software.csv
Info

Pipe Redirect this output to a file:

Code Block
[intro_to_linux]$ grep -i bayes software.csv > apps.txt
[intro_to_linux]$ ls 
apps.txt  clusters  data  software.csv
[intro_to_linux]$ cat apps.txt

...

Code Block
[intro_to_linux]$ cat fruits.txt
Gooseberry
Apple
Apricot
Avocado
Strawberry
...
[intro_to_linux]$ cat fruits.txt | wc -l
97
97

Info

We could use the wc command as it is normally intended, and confirm the file contains 97 lines.

Code Block
[intro_to_linux]$ wc -l fruits.txt
97 fruits.txt

...

Example continued

Info

First step, find all the terms that contain the sub string berry.

...

Code Block
[intro_to_linux]$ cat vegatables.txt | grep -i beans | sort | uniq -i | wc -l
12
Note

Make sure you are use the commands and options as you intend and understand and be able to describe and explain/justify.

Notice the difference between:

Code Block
[salexan5@mblog1 intro_to_linux]$ cat vegatables.txt | grep beans | sort
...
kidney beans
...
soy beans

and

Code Block
[salexan5@mblog1 intro_to_linux]$ cat vegatables.txt | grep -i beans | sort
...
kidney beans
kidney BEANS
...
soy beans
Soy Beans
  • What happens if you use bean instead of beans?

  • What does the uniq -i option do?

...