 Okay, as always, this is part of a series, and there is an annotation on the screen, or at least there should be. It will bring you to the full playlist. I think this is video 12 in the series. So I recommend watching the other 11 before this one. But let's go ahead and get started. We're working with SED. So far we've been working with this text file, or just some random stuff in there. Just to make things for the next few tutorials, I created another text file called Text2. Text2 has a blank line, and I numbered each line to make it easier for you to see which lines are being removed. But today we're going to be looking at removing lines based on strings. So let's say we want to remove every line with the word new in it. All we have to do is say SED, and then give it our delimiters here, and our text file name, which is Text2. In between our two delimiters, we're going to tell it which string we're looking for, so we'll say new. And all we have to do is after this, we can do D, and I think it works with both capital and lowercase D. So if we do this, every line with the word new is removed, and then here we'll go capital D and try it again. So it doesn't matter in this particular case with the D, whether it's capital or lowercase. But you'll notice that we still have a line with the word new on it, line 9. And that's because that was written with capital letters all together. So what we can do is we could put a capital I here, tells it to be case insensitive. So it says look for the word new, the string new, and don't worry about the case and then delete it. And once again, it doesn't matter what the capital lowercase will hit enter. And you can see now line 9 is gone because we said don't worry about the case. Let's go back and let's say we do worry about the case. You'll notice if I cat out that file again, so we can see the whole thing, that this line is removed. And it doesn't have the word new on it. It has the word news and it has the word newer. The reason that it's removed here, line 10, is because we are getting a match for new here, even though it's only part of the string. One way to get around this in this particular case would be to say delete lines with the word new and we can hit space. And so look for lines with the word new and a space and we'll hit enter there. And it removed line 3, as you can see, line 3 is gone. But now we have the issue of line 8 being here because line 8 has the word new but doesn't have a space after it. Well, in this particular case we can use what we learned in the last tutorial on boundaries. I think that was the last tutorial. Oh, and actually it looks like that was tutorial 12. So this would be tutorial 13. So watch the first 12 videos before this one. But if we come in here and we can do our backslash b, backslash b would be a regular expression saying find the bounds and hit enter there. You'll see that it found anywhere where the word is new, the whole word is new. It's ignoring newer and we could also go back and do the same thing with our capital I, which does have to go before the D. I'm not sure if I said that earlier. I'm pretty sure if you do it after the D. Yeah, you get an error. So it's saying case and sensitive to leave it. So now line 10 is still there. Let's cat out our original file. So line 3 is removed because it has the word new. Line 8 is removed even though it has newer here, it does have new here. And line 9 is removed because it has the word new, even though it's capital because we said case and sensitive with our I. And the word news and newer is not removed from the file because they are not the word new. They're the word news and the word newer. And of course just throw something in here at the end. So let's say we want to remove any line that ends with something or begins with something. We can say remove lines that end with newer and we can give it a little dollar sign. Because if you remember from way back a few tutorials ago towards the beginning, we said dollar sign means end of line. We're saying find lines that have the word newer at the end and delete them from text too. And again we're not doing this in line, we're just changing the output not modifying the file. So you can see here that line 10 is removed even though newer is here it's not at the end. We're saying at the end here. And we can also do the same thing with the beginning line which begin all my lines are numbers except for line 5. We can say find line that begins with 6 and delete it. And then you go line 6 is removed. Now that's not removing line 6 because it's line 6, it's removing line 6 because it begins with a 6. Let's go back to our original text file here and say we want to remove this line here. We can say find the line. Let's say we want to remove this line and this line because they begin with a capital T. We can say remove from text any line that begins with a capital T and removed both those lines. And if I did TH now it only removes the line 2 which is this, is that because it starts with a TH. So that's deleting lines based on string matches. So I hope you enjoyed this tutorial. Plenty more coming on said in the coming weeks. Said is a very powerful tool, has lots of different functionalities. And I need to get better at it so that's why I'm making these tutorials. So I hope you're getting better at it, I hope you're enjoying these tutorials. And I hope that you visit my website, filmsbychrist.com, that's Chris at the K. There should be a link in the description. Also check out the rest of the playlist if you haven't. And I hope that you have a great day. Also, I'm still here. Also, I don't think I've mentioned yet in this series but although I have in a lot of my other videos. Comments are not a good place to ask questions. I love if you comment, let me know whether you like the video or not. Be sure to like, subscribe the video as well. But if you have questions, a better place to ask them would be in my IRC channel. If you go to my website under the social networking tab, there's an IRC link. I'm not always in there but there's always people in there who are usually very helpful. You may not get a response right away. Ask a question, hang out, wait for an answer. And even after you get your answer, hang out. The more we all hang out there, the more we are there to help each other. But IRC is not a place to get an instant response. It's a place to hang out and discuss stuff. So, technical questions, don't want to ask those in the comments. You're going to want to ask them in the IRC channel. And I mean you could ask them in the comments but most likely there's a good chance they're not going to get answered. At least not by me because I don't have time to look through all the comments every day. Anyway, I hope you have a great day.