 Okay, so let's say we have a number whether we randomly generate it which we'll look at in a moment We went over that in a previous video. Let's say I have this number I'm just going to run my finger across the keyboard a few times, you know, I can echo that out There's no commas in there, which makes it kind of hard to read One I'm going to show you three different ways to add commas into these numbers And this first way is using a said command Which is kind of long and lengthy, but basically we're you know, we're looking for numbers I think at three. This is just some code that I have found and I've used But it's looking for numbers sets of threes and adding a comma is basically what's going on here I do that and you can see we get commas everything. I know different countries do things different some countries Put commas where we put periods and periods where we put commas, but general idea So that's one way to do it Kind of ugly and sloppy although said is a very common tool another tool that I don't see use much But is part of the core tool library So is your package manager you probably have this installed, but it's called core utilities I think is the package this is in it's the num format I'm assuming is what that stands for and what we can do is we can say dash dash grouping and We can give it a number so I'll just get a big long number here and you can see it put commas in there And you can even shorten that up. You can just do dash dash G for the same thing now in last with said we were piping into it, which is sometimes useful so I can say echo and I can give a number and this numb Format dash dash G will accept piping so that works as well Both of those are external tools. We can use printf which is built into our bash shell so this will be a pure bash thing printf and what we're going to say here is percent apostrophe D and Then we will give it a number like so and you can see it put commas now You notice it doesn't give a new line at the end of that That's because printf doesn't buy default we can say backslash n and that will give it a New line at the end of that so that's great. I'm not sure if there's a way to pipe into printf. I tried that and didn't work so What we could do is we could pass it something else So for example in a previous video. I showed you that you could use the shuff command And give it some arrange. So we'll just say We'll give it from there to 3 4 5 sure something like that dash and 1 and that will give us a random number each time We run it, which is nice between those two two ranges and numbers Or two ranges those two numbers the range and numbers between those two something like that anyway And of course we could pipe this into our set command So we're gonna generate a random number and I'm just gonna paste our set command again because it's kind of long And I have do not have it memorized and there you go You can see each time we run this it gives us a random number with the commas in the right spot We can make that a little bit longer maybe Just so we can see some more commas in there to show there you go That is putting commas in there and of course just like before we can use the num format dash dash g And it will do the same thing But let's say we want to create a random number and put the commas in there using printf So what we would do is we'd say printf Just like before quotations inside the quotations. We're gonna say percent apostrophe D And we'll give it that new line character why not right and I'm gonna do back tick back tick That's one way to run a command and have the output put there. So I'll just say I and I'll say And I'll say five So there we go and dash and for one and so now I Am running that script to get a random number in printf will put in The commas where we want them and of course we're doing the new line there with the dash n but we can also prepend stuff or append stuff to this if I want so I can say the number is and I can say this and I can go And it prints out the number is this with the proper commas in there. I can also say something like you have One and I'll give it a dollar sign here And now it's printing out you have one and it's giving you you know a dollar amount so that's one way of Generating something or getting the output of a command and using printf even though I don't know if you can You know pipe to standard input on printf Unaware if you're able to if you can and someone knows let me know in the comments below But I hope you found this useful I'll try to remember to link to these examples in the description of this video and as always Thank you for watching. Please visit films by chris.com. That's Chris the K There's a link in the description as always. I hope that you have a great day