What command will allow me to list all flienames
that meet ONLY the following criteria:
- The length of the filename is 6 characters
- The 2nd character of each filename is a digit (i.e. number)
- The last character of each filename is an uppercase or
lowercase vowel
@Trevor Let's see if this serves successfully at your service :
posix-extended refers to POSIX Extended Regular Expressions (ERE). ERE provides a richer set of metacharacters and features compared to POSIX Basic Regular Expressions (BRE). https://en.wikibooks.org/wiki/Regular_Expressions/POSIX-Extended_Regular_Expressions
./ That's just to make sure we're looking in the current folder.
. Means any single character can be here.
[0-9] This spot has to be a number, from 0 to 9.
.... Followed by any four characters.
[aeiouAEIOU] And the filename has to end with a vowel, either uppercase or lowercase.
Then, -printf '%f\n' is just telling find to give us the filenames nice and clean, without all the extra path info. Just the names, one per line
I distinguish listing from finding.
So I go with ls command, instead of find.
ls ?[0-9]???[AaEeIiOoUuYy]
Red Hat
Learning Community
A collaborative learning environment, enabling open source skill development.