 Okay, again, this is a series check out the annotation for the full playlist we've been playing with said and today We're going to be looking at removing comments from a script In particular in this case a bash script. So if I cat out I have a file here I created just for this tutorial called script you can see it's a bash script and you got your shebang line You got some comments. You got some code then you got another comment and you got another comment here, so What we're going to do here is we are going to remove all comments So you might think If we went said we can say To do this we'll give it a script file and we will say D We know means delete and we can say every line with the pound symbol So we do that and we get our basic code, but we have two problems the first one being We're missing our echo line here because it had pound Okay, so that that's a simple fix Because we're going to go comments Lines that start with pound. I mean, I mean, there are like there could be some lines that have Comments at the end of the command, but for this tutorial we're talking about ones that at the beginning of the line So we can do that we can say find All lines that have a pound symbol at the beginning and we could hit enter and that fixed our little echo line here for echoing out the Title, but you'll notice that we're still missing our shebang line if we cat out our script file all script files should start with a Shebang line that tells your operating system. Oh This is a bash script or this is a seashell script or this is a said script or an ox script or a Python script or a pearl script. It's not necessary You can only start the command with bash and if bash is your default shell it will default to it But it's always good to have it. It's just You know one step towards being a better programmer because if you leave that out You know and the end user doesn't know to start it with bash and they're using a different shell It will try to run and and it will just cause problems So we want to remove all the comments, but keep that line and the way we're going to do that Is not too different from what we already have but we're going to do is before we say find all that start with the Pound symbol we're going to say one exclamation mark and then we're going to say put this command inside curly braces there with a Semicolon at the end there I'm pretty sure the semicolon has to be there. Anyway, what this is doing is saying Skip the first line and then start to search here So we're going to hit enter here and you can see we have our our bash script there So if I was to change this from a one to two It would now skip two lines and then start so we don't get our our bash Shebang line because it's ignoring everything before line two. It's going Go to line two and then start searching. So we'll say, you know, sir. I'm sorry Skip the first line Here we're saying Yeah, start at the first line and then everything after that remove this one's going You know skip the first line go to the second. So it's not even displaying the first line so For our example, we are Skipping the first line then we're going to search for all lines that begin with the pound symbol number symbol Tic-tac-toe symbol, whatever you call it. I know different countries call it different things And then we're going to delete all those lines that that meet this requirement from this and again, we're Changing the output here. We're not changing the actual file if we wanted to we would do our dash I for In file in line whatever it stands for or we could always redirect it into a new file if we wanted to So that is removing comments At least a basic way of removing comments from a script file if you wanted to for some reason Short shorten it down for some reason You know, it also like I said in this case that some of the comments would could be the you know The the creator of the script and the license and you don't really want to be removing that stuff But for personal use maybe for some reason you need the file to be shorter Or you're just trying to make it easier to read you're like I don't want to see all the comments I just want to see the code whatever your reason there you go Thank you for watching be sure to watch the rest of the videos in this playlist This is like 13th or 14th video There should be an annotation on the screen check it out also Check out my website films by Chris calm That's Chris the k there should be a link in the description be sure to like subscribe if you enjoy these tutorials Check out my other videos on Wednesdays and Fridays on other topics But every Monday for the last couple weeks and for the next couple of weeks. We'll be working on set on Mondays So keep on checking them out And I hope that you have a great day