Filter Filenames Using Character Classes in Bash
📖 Scenario: You have a folder with many files. Some files have names with only lowercase letters, some have numbers, and others have mixed characters. You want to find files that have only lowercase letters in their names.
🎯 Goal: Build a bash script that lists filenames containing only lowercase letters using character class [a-z].
📋 What You'll Learn
Create a list of filenames stored in a variable.
Create a pattern variable using character classes to match lowercase letters.
Use a loop and conditional to filter filenames matching the pattern.
Print the filtered filenames.
💡 Why This Matters
🌍 Real World
Filtering filenames based on character patterns helps organize files, automate backups, or process specific file groups in scripts.
💼 Career
Understanding character classes and regex matching in bash is essential for system administrators and automation engineers to write efficient scripts.
Progress0 / 4 steps