To show wild cards in action I will firstly use them for some Linux commands.
But firstly we need to create some files for practicing so we will create certain text and so the image
files
for creating City files I will use for loop as if we didn't cover this topic yet.
Just type in the same as me and we'll explain it more deeply in a separate section.
But basically I am here sometimes Times looping.
And inside each flow I am creating a file ending with a number of between one to serve the and same
also for image
using a command.
We can see that we have created some text and cirrhotic image files.
So now let's make some wildcards
let's say that we want to list files ending with 8:59 don't text.
So file one file two files three up to file nine dot for these values range inside square brackets.
So type out as file square brick get 1 Dash 9 end of square bracket dot text
and we can see that it lists file one file to up to file nine dot text.
Now let's make it more difficult and the list files ending with 8:59 for both text and image extension.
We are starting with the same class file square Brigade one dish 9 and it's end of square.
Don't.
But now we need to say Do this for text and image extension and we are doing it using curly brackets
comma separated Dharam we can see that it lists file one file to up to 5 9 for boat extensions.
Great.
Let's move on something more difficult.
Lists files ending with five to 15 dot text.
You can stop the video and try it on your own if you want.
You know how we will display file 5 up to file 9 using square brackets.
But that's not the solution because we want to display also file followed by number one and then followed
by 0 up to 5 solution.
Here is to.
Kurt lubricates inside them for the first part we specify in square brackets.
31 8:55 disability files ending with 5 to 9 dot text as a second part inside curly brackets will specify
wildcards for listing file 10 to 5 15.
So we need to write one and it doesn't need to be inside square brackets.
If there is only one number inside square brackets it means the same as that number without brackets.
Because square brackets means range and we shorten the range to only one number an inside and hador
square brackets we will specify a range 0 to 5 so it will match 10 11 12 13 14 15 and as it works perfectly
you can see four or five up to five 15.
Great.
Now we can try one of the most common wildcards music we've list all image files
to do that.
We type out as asterisk which represents any number of connectors.
Then we specify don't dot MGE a specific extension.
Great.
We list all image files.
Now I will create a screen
and then we can use wildcards for removing files
so remove files ending with 16 up to 21 that I MGE
to do that will again use curly brackets on the first part of them.
We will specify a range 16 up to 19
and on the second part specify a range.
Then they do find the one.
Now we can check if that follows variability and
and yes they were removed.
You see how wildcards are really powerful
but let's make now last example using wildcards
to list all files which has three characters long extension starting with the letter T.
To do that type out as asterisk dot the question mark question mark as question mark three persons one
character and NEA's we see all textfile displayed.
We can now clear the screen and write some script to see usage of wild wildcards in string comparison.