 I want to show a little use of the command line and VIM in my daily life, something that's a little strange that's very easy if I'm doing it on the command line, at least with the tools that I have. If you look behind me, my room here is actually a mess. I've been going through all my books. Basically, I've been getting so many cheap books recently. I've found some nice stores to get them that I need to start organizing my books. And what I want to do is I want to use the Library of Congress's classification scheme. If you look right here, the comments here are the classification numbers and letters for each of these books. I've been going through all my books, getting them actually from this site. But I want to talk about, so here's the thing. I want to get to the point, once I get all the numbers for all these, I need to be able to sort them all so when I try and put them in the order, I'm not constantly going through them. That's what I want. Here's what I want. I want all my books in the exact order of their call numbers. That's what I want. Now, what I'm working on right here, if you've ever been to my website, actually, I already have it pulled up. If you go to my website, actually, if you go to lukesmith.xyz.library, I actually have a public list of all the books that I have, a good bit of them now, I mean ever increasing. So I've had this already. So what I'm actually doing is once I find these call numbers, I'm really just adding them as comments to the end of the line. So let's talk about what I want to do. I want to sort, now that I have nice little lines, I've nearly done all of them. I haven't done all of them, all of them. Actually, let me show you. I could grep out, let's say I grep out the sequence of a list item from that library file, and that will give you a list of all of my books. So now we're only looking at the lines that are books, not any of the other HTML. In fact, what we can do, we can pipe that into WC, and we can see that I have 333 books right now. But here's what I want to do. I want to be able to sort all of these. Now there is a command called sort, and I want to use that. But the thing about that is that you really have to sort it by the thing that's at the beginning of the line, not the stuff that's at the end. And here, they're all at the end. So let's talk about how we can get this to the end. Well, now that I'm in VIM, one thing that VIM has very nice, now look at the bottom. I'm going to run a command, and I'm going to type in, do I have a screen key installed? I don't actually know. Okay, yeah, I do. So I'm going to type in colon, and then I'm going to say g. And what g is in VIM is a global command. That is a command that you can run anywhere. Basically, the first thing you give it, you give it a slash, and then you give it the sequence that you want to match. And the sequence that I want to match here is actually going to be, it's going to be looking for every line that has this sequence. I want to match this thing right here, this little comment. So what I'm going to do is I'm going to say, you know, open the comment, and then exclamation point, and then two hyphens, and then a space, and then I'll make it more specific. I'll say any sequence of a to z, and actually I should add a plus to that because sometimes you'll see some of these are key way. There are multiple letters, and then multiple numbers. So if I do that, let me just show you what that looks like. I can now run any kind of VIM command on all the lines that have that sequence in it, if you see it down in the corner. So let me actually do that. Now I can do something like, now I actually like to run normal command. So if I say norm, let's say I say norm dd. What that will do is it will run the normal command dd, delete a line on all of those matching lines. So if I run that, all of those lines disappear. It says 292 fewer lines. It's not all 333, that's because I hadn't given them all call numbers. Some of them didn't have it, some of them haven't gotten to. But that's what you do. So let's go back to that command, and instead of norm dd, I want to run commands that get that comment to the beginning of the line. So let's visualize what we actually want to do. Well, we're really looking for VIM commands here. So let's say, go to the end of the line, dollar sign. And then I want to go back to the beginning of this comment. Or actually, no, what I could just do is I could say, delete around the brackets or whatever, and that will delete the entire comment. And that is saved in our buffer. Then what we can do is we can say 0 to go to the beginning of the line, and then capital P to paste it on the left side of your cursor. So I'm just going to run that, and you'll see what happens is that all of these comments are now, instead of at the end of the line, they're at the beginning of the line. So I'm going to save that file. Actually, I can probably just keep it like this because they're just comments. I don't think it makes a difference in HTML if they're at the beginning of the line. But I will go back to my shell here. And what I can do now is I can grep out, again, I can grep out those list items. It's set for now. Here are all my entries, but now the comments are at the beginning. So what I can do is I can say something like this. I can pipe them into sort. And once I do that, you'll see that all the ones with the call numbers are sorted by their call numbers now. And that's what I want. In fact, I could probably do one better for now, and I'll just pipe that into less. So now I can just browse through it. So now you'll see that I have all of this stuff, all my stuff is now sorted. So this is exactly what I want. So now what I can do is I could go through this list. And as I go through my books, I can just see, oh, I need language, truth, and logic. I'll get that. Then Epicurus, letters, and sayings. Then E.O. Wilson's conciliants, stuff like that. I can just go through individually each list item in real life instead of going through the list and making it all confusing. So anyway, that's a minor example. People are always asking me, oh, how is this useful? This is one little thing where it's useful. So I do recommend you check out global commands in VIM because they're a little more powerful than you think. I think originally when I started using VIM, I would use things like, you know, I would make macros to do that kind of stuff. But it's a lot easier to run global commands, and as I showed you, you can run norm to run any kind of sequence of normal commands, normal mode commands. So anyway, that's about it. I'm going to get finished working on this stuff, and we'll see you guys next time.