Using regular expressions with grep


show more Using regular expressions with grep provides you with in-depth training on IT. Taught by Kevin Skoglund as part of the Unix for Mac OS X Users show less
please wait ...

Using regular expressions with grep

So we've already gotten a look at the wildcard, the period, and we've also seen character sets when we were working with finding both peach and pineapple. Let's try the beginning Of line and end Of line anchors. So for example grep and the beginning of line anchor followed by P inside fruit will find every line that begins with P. Notice it did not match apple. Apple has a P in it, but it's not at the beginning of the line. I am going to do the same thing. We can find everything with berry at the end and that will return every line that has berry at the end.

Now in this case actually all occurrences of berry were also at the end of the line, but it would find it if it were only at the end of the line. Let me show you that. One way that you can work with grep that's really useful is instead of working with a file, let's say we have berry bush, we can use pipes from echo, so we'll pipe-in the string, and then we'll grep for 'berry$'. Now, it didn'...

Using regular expressions with grep
Video duration: 5m 20s 6h 35m Beginner

Viewers:

Using regular expressions with grep provides you with in-depth training on IT. Taught by Kevin Skoglund as part of the Unix for Mac OS X Users

Subject:
IT
Software:
Mac OS X Unix
Author:
please wait ...