 Hello, and welcome today. We're gonna be appending numbers to the beginning of lines in a file. There's multiple ways you can do this I'm sure I've done this would said before but I'll stop my head. I can't remember that command So what is an easy command to remember? Well, if you have it on your system NL does just that Let's have a quick look at the man page So the manual here it says number lines of file and you have some options here So let's just see it in action. So what I'm going to do is here I have a file in here called words if I cat it out You'll see it gives me a list of words. So how do we append numbers to the beginning of these lines? Well, we take this and we pipe it into an L and what are we gonna do? We just hit enter and it appends numbers to the beginning of each line Now we do have extra space at the beginning of here And if we go up you can see that we have some single Digit numbers and some dual digit numbers. So how can we adjust some of that? Well, let's run the same command, but we're gonna do a say dash n and then in quotation marks We're gonna say rz. Okay, and what this is saying. Well, we'll look at the man file in a second Let's see what it does. So it removed it Adjusted it so that we have some leading zeros and everything's moved over So let's look at the man file again real quick for NL and so we did our dash n So let's move down to dash n and dash n says oh, we're giving it a number format where the format So if you scroll further down in here, you can see format is one of the following We can do left justified with no leading zeros right justified with no leading zeros or Right justified with leading zeros. So that's what we did we added it So it's right justified and it has leading zeros By default it's going to give you six character numbers here for the leading zeros That is unnecessary in some cases. That's that's a lot of zeros one right here We know that we're only I have two digits. So what I can do here is I can say dash W and tell it how many numbers I want And I will say two in this case So here it's we have our two digit number and I go up and you can see that our we have two digits for our one two three all the way through nine now be aware that if you put a number less than the number of Digits in that number. So let's say you had a number that was like 2000 Uh, and you put I only want to be two characters. It will show 2000 there It will just remove any extra leading zeros. So what I mean by that Let's just say it's a one right so we should get one digit numbers But you can see we still get 50 But if I was to go up you can see that up here There's no leading zeros because I said only add a leading zero if it's uh, basically more than one I hope you found this useful again. I know there's other tools to do this. You can do this with sed But nl is just easier to remember than the sed command for adding the numbers I think there's other commands out there to add leading numbers to files or anything you pipe into it But nl for number line is easy to remember. We're going to use this in a future tutorial So if you found this interesting be sure to subscribe and keep on watching and I hope that you have a great day