From the course: Bash Patterns and Regular Expressions
Unlock the full course today
Join today to access over 22,700 courses taught by industry experts or purchase this course individually.
Pattern matching with extended globs - Bash Tutorial
From the course: Bash Patterns and Regular Expressions
Pattern matching with extended globs
- [Instructor] Now let's look at a real world example. In this scenario we created a great deal of backup files over the years and stored them in a directory. Be sure you're in your test files directory that we created in the last video, then type in ls. The format of these files are Archive or Backup followed by a dash then the year, dash, the month, dash, and the day followed by a combination of different archives and compressors. Let's build up an extended glob to match only these files. We'll start by matching the first part of the name which is either Archive or Backup which is then followed by a hyphen. Type in ls, space, at, left parentheses, Archive with a capital A, pipe, Backup with a capital B, right parentheses, hyphen. Then we'll use four character sets to match the year. Type in left square bracket, zero dash nine, right square bracket four time followed by a hyphen. Now we need two more character sets to match the month followed by a hyphen. Notice the month is always…
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
-
-
-
-
-
-
-
-