 Okay, again, this is part of a series. There should be an annotation on the screen leading to the playlist I recommend if you haven't watching the first two videos is the third in the series now today's tutorials going to Show you how to do something And you might go I'm not going to give you like a real good scenario for it now But this is stuff we're going to use in the future it might make more sense in the future But I want to show you how to do it now first things first. Let's cat out the text file We've been playing with this is a text file. I made just for these tutorials there's some random stuff in it and Real quick, let's do something we learned in the first tutorial just to modify it a little bit I'm using a dash I to say that I'm not just changing the output But actually modifying the file and I'm going to change all T lowercase t's to capital T's And then I have to tell it which file I want to modify which is the text file So now if I cat out text you can see I changed from before everything was a lowercase t Now we have all these capital T's Okay, so what we're going to work today with is is how to just give it a regular expression to Say look at all numbers or all look at all letters or look at all alphanumeric Characters look at all capital letters. Look at all lowercase letters So that's what we're going to be working with today. So if I say said and again, we've got inside our single quotes here a s for substitute g means global which means we're modifying all instances that we're looking for I can say inside square brackets here Zero dash nine meaning look at all numeric Characters and I can say replace every numeric character So we're not looking at alpha characters are not looking at letters in the alpha that we're looking at numbers And replace them with an asterisk and that's within the text file again There's no dash I here so not modifying the file just changing the output and you can see everywhere that there was a Number there is now an asterisk now. I can do the same thing with a dash Z and But some doing a lowercase a and a lowercase c. I'm only going to be modifying lowercase characters So all those capital teams made earlier won't be affected, but all lowercase characters should be asterisks now boom now, of course, I can change this to a capital a and a capital Z and hit enter and you can see it now It's only affecting the capital letters now. We could go a Dash Z This is not going to change all lowercase and capital letters Let's hit enter and you can see that the only place it changed was right there because this is what this is telling it is to look for a Lowercase letter followed by an uppercase letter Not looking for this and that we're looking for this and that together so we want to do All lowercase and all capital letters You could do this and we can say a dash Z Capital a dash capital Z and that will get it I also think and I didn't text test this, but I'm pretty sure if we just do lowercase to capital Z No, that does not work. Let me try something else capital a to lowercase c Okay, that works and the reason that the Lord the capital a to the lowercase z works and the capital a Or lowercase a to the capital Z does not work I believe is because if you actually look at ASCII an ASCII chart and look at characters capital letters come first So you're in the first one you're asking asking it to go start in the middle and go back to the beginning Not from the beginning to enter ends the beginning, but in the second one we're going Everything so you can do it this way or this way this way is a little bit shorter We can also after that say Zero dash nine and that will get all Capital and lowercase letters as well as all numeric characters So everything but our spaces and new line characters in this instance are being replaced I would not be surprised and I haven't tried this yet if we could do something like this. No, maybe maybe I'm kind of making stuff up now zero through Capital Z there we go. And if we did a lowercase z since lowercase there we go So that's actually another shortcut if we went zero dash z lowercase z That will replace all letters and all numbers both capital and lowercase if we want to just replace Numbers and capital letters we do through z you can also do part of the alphabet. So we could say here a through h So anything a through h will be replaced we can also start halfway through we can say m through z And it's replacing everything in this case lowercase m through z And of course you could do the same thing with capital as we only have capital t So I'm not going to bother showing that you can do the same thing with numbers though We can say zero through four. Let's do through four and now zero through four being replaced And the five is not because the five is outside of four um, so, uh Few different ways of doing stuff. Let's quickly review We'll just scroll up here uh Just want to replace capital letters You do show us a through z there Replace just lowercase letters a through z lowercase Just numbers zero dash nine Again, you can also do Uh lowercase a and z uppercase a and z But as I showed you a shorter way of writing that is capital a through capital z And of course if you were to do like a capital m there, it would do all uppercase letters and half of the lowercase letters um And uh, we can do All letters and numbers both cases this way or a shorter way would be um zero through lowercase z would get them all Um, but you can kind of see the pattern there. There were a few things I actually tried here that I hadn't tried before but I thought would work and they did which is happy um And again, it's if you want to replace a You know, this is a lowercase string followed by an uppercase string You can also do letters like if I wanted to let's do this we'll say replace all um capital letters That are followed by an i So here we it replaced The t and the i because it's looking for both those things and replacing it with that It's not looking for one or the other it's looking for the two together And the only place where there's a capital letter followed by an i was the word tiny And uh, of course you can go um Any place where there is a you know, then I don't have any I was going to say any anything any number followed by a letter But we don't have any instance of that because all our numbers are separated by spaces But if we had a number followed by a letter with no spaces that would accomplish that And again, we were just replacing them with uh, asterisks here, but you can replace them with Whatever you want. So there we replaced the t and the i and tiny Uh with those letters So, um, I hope you found that useful and again, we'll be using Some of these things in future tutorials. So keep on watching. This is a series we're working on for a couple of weeks on sed So come back next monday. I also have videos other days of the weeks Currently on wednesday and fridays on uh other topics, but mondays are our shell script or general linux operating system tutorials Uh, I hope you're enjoying these on sed because we've got some more to come Very useful tool a lot of us know that I like myself know the basics of it I'm learning a little bit more just to get familiar with it and as i'm learning i'm sharing it with you So I thank you for watching. Please visit filmsbychrist.com. That's chris of the k There should be a link in the description Check out the annotation on the screen for the playlist and I hope that you have a great day