Hdi2u S21
Grep
- grep stands for "global regular expression print"
- you use this command to search for text patterns in a file, for example, Linux's mini-dicitonary.
grep "adge" /usr/share/dict/words
- regular expressions are different and more powerful than wildcard characters
- made of special symbols which designate type of characters.
- grep requires a regular expression pattern as a parameter, and prints all the lines in a file containing that pattern.
- grep is especially useful in combination with pipes as you can filter the results of other commands.
- For example, perhaps you only want to see only the information in an EMBL file relating to the origin of the
sequence, that is, the DE line?
Exercise
- While in the hdi2u_files directory, type the command:
grep "DE" hsy14768.embl
What is this command doing?