Issue
I work with pseudonymized data where pseudonyms are strings 9 characters long containing either letters a through f or numbers 0 through 9.
How can I make ls
show only entries with such names? Would this also work with grep
and find
?
I know that I can specify a single character as [a-f,0-9]
, but how can I specify that such a character appears 9 times?
Solution
ls:
ls | grep -E '^[a-f0-9]{9}$'
find:
find /path/to/directory -type f -regex '.*/[a-f0-9]{9}$'
Answered By - TheAlphaGhost Answer Checked By - Pedro (WPSolving Volunteer)