From the course: Bash Patterns and Regular Expressions
Unlock the full course today
Join today to access over 24,400 courses taught by industry experts.
Using extended globs with commands - Bash Tutorial
From the course: Bash Patterns and Regular Expressions
Using extended globs with commands
- [Instructor] Now we'll use some extended globs with some commands instead of just matching file names. Make sure you're in your test files directory that we created earlier in the chapter. My path is slash home slash user one slash exercise files slash chapter two slash test files. Now let's do some pattern matching with some destructive commands. In the last video we matched the archive and backup files, which looks like this. Now let's invert this glob by encapsulating it with an inversion glob. This will show us the files that the glob does not match. Prepend the glob with exclamation point, left parentheses, asterisk. And then go to the end of the glob and add asterisk, right parentheses, and hit enter. This brings up three files. Two of the files appear to be backup files but don't have a day field in their name. These files are problematic because they don't follow the pattern of our other files. We don't know which day they were created on but we can add an arbitrary day into…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
What are extended globs?5m 2s
-
(Locked)
Why you should use extended globs4m 37s
-
(Locked)
Make extended globs persistent1m 10s
-
(Locked)
Getting started with extended globs3m 4s
-
(Locked)
Pattern matching with extended globs5m 44s
-
(Locked)
Using extended globs with commands5m 1s
-
(Locked)
Comparing extended globs with regular expressions2m 22s
-
-
-
-
-
-
-
-