 Hello and welcome! Today we're going to be working with numbers still. We're working with numbers in the last couple of videos, generating random numbers, putting commas in there, and today we're going to be looking at sorting numbers. So again, I'm going to use the SHUFF command. Again, I showed you a few different ways to generate random numbers, and the SHUFF command is just the one I'm going with here. So I'm going to say, create a random number between 10 and 100,000, and I'll say, give me 10 of those. So it's generating 10 different numbers randomly each time I run this, as random as a computer can generate. Well, no, that's not true. They can generate things even more random, but random enough for this example. Now again, I mentioned in previous video, you can pipe in a sort, which usually sorts things alphanumerically, well alphabetically, and if we do that, you can see that doesn't quite work right. It's looking at this, and it's going character by character, or number by number, and here it's saying, okay, this starts with a 1, so it's going at the top of the list, even though this one is obviously a smaller number. It is quite a bit smaller, but it starts with a 2, so sorts putting it in this particular order. And if we did that a number of times, you'll see that happen quite often. Let's see. It's not really giving us lower numbers, and it should be. I guess we have a very large range here. But there's an example. I mean, this is the smallest number in the list, and it's showing up at the bottom because it starts with a 9. Same thing's happening there, but you can see, again, right there. So anyway, I was just trying to show you a few examples. How do we get it to sort numerically rather than, I guess you would call it alphabetically? I don't know, procedurally my character. Anyway, sort can do it, and sort is a very common. It's on your Linux system. It's just everywhere. Dash G. Dash G. We'll tell it, these are numbers. Sort them numerically. There we go. We got a real small number there, 30, where if I didn't have that dash G, that would have put that right here before the 4533. But you can see here now it's finally sorting things numerically rather than based on characters trying to get there. There's another example with the 500. Would have been further down on the list if we didn't have the dash G there. So things to be aware of, though. There we're looking at just plain numbers. In a previous video, I showed you how to use different techniques, one of them being the numformat dash G to put commas in your numbers. So here we're putting commas in the numbers, and that will mess up our sort. So if we try to, now let's clear the screen, sort dash G, you can see it's not working right anymore. The commas throwing things off. So if you're going to sort numbers, make sure they don't have commas. If they have commas, use set or something, or TR to get rid of them. And if you want commas in them, just do it the other way around. So we'll generate a random number, we'll sort it, and then we'll put it into numformat dash G. And now we have output in the proper order with the proper commas. Let's go ahead and generate some larger numbers here. So there you go. We're doing good now. So the order of operations is important here. You do not want, if you're sorting by numbers, to have other characters in there, you want to sort the numbers and then add in those characters, whether it be commas or dollar signs or anything of that nature. So I hope you found this video useful. If you did, thumbs up, like, subscribe, comment, visit filmsbychrist.com. That's Chris Decay. There's a link in the description. There's also a link to my Patreon page. I appreciate you watching, and I hope that you have a great day.