 Okay, as always check out the annotation for the full playlist. We're working with said in the series I have no clue what story this is. I think around 15 or something Again check out the playlist and last week we looked at Counting the lines in a file Getting a total number of lines and actually displaying a number for each line. Well this week We're going to look at numbering those lines so you see each line with a number so Last week we did something like this Text is our text file and the equal sign is saying hey display a number for each line but when we do that we get Line one it's saying yeah line one and then what line one is line two This is line two line three line three was blank so forth and so on so but we want what we want is To have one and then the line two and then the line We don't want them on two different lines like this and the only way I could find to do this is by piping into a new set So we are starting a new process I would have liked to have figured out a way if it's possible to do it all in one command without starting up a New said command, but this gets the job done so Here what we're going to do is we're going to say Inside our single quotes here capital N Semi-colon s forward slash backslash and forward slash space forward slash and what we're doing here is We're saying okay for the lines that are coming in and means append so we're going to take This and append this to it and then here we're saying oh where there's a new line put a space So that it's looking nice So we're going to enter here and there we go. We have each line displayed and numbered Now let's say for some reason you didn't want to number the lines that are blank So example line three here is blank What we can do is we can come back here and in our first command say forward slash dot forward slash and what that's saying is That's a regular expression saying only fine lines that have more than one character So I've hit enter here things don't display right because now with the first two lines are okay Then we didn't have a lot on thing for line three and then line four says here and then the flying for five so what we have to do is Do the same thing over here line forward slash? Sorry forward slash dot forward slash saying the same thing only work with lines that have more than one character So if we hit enter here, you can see now we have One and then line one two line two so each line is numbered But we have skipped the empty lines if for some reason you want to do that Let's go ahead and put dash in here So if we wanted to append with something other than a space we can do that and we can do multiple things in here We can do a bunch of dashes. I think I'm gonna try something. I'm not sure if this is gonna work back slash t Okay, we'll put a tab thought it would think I did a tutorial on that recently So so you don't have to just do a space you can replace that new line between the number line and The line itself with whatever characters you want So that is numbering lines all the lines in text file or numbering all the lines except for the empty ones So I thank you again for watching come back next week on Monday for another sedentary Of course if you're watching this in the future that videos are we out and it will be in the playlist again Check out the annotation my website films by chris.com. That's Chris the K Should be a link in the description. Be sure to check that out You can search through my videos and play this there or you can just do it on my YouTube channel and I have plenty of tutorials up and on said shell scripts in general and a bunch of other languages check out my videos on Wednesdays and Fridays as well I hope you subscribe like and comment have a great day