Issue
If I have these files:
- a.txt (50 characters)
- b.txt (21 characters)
- c.txt (46 characters)
- d.txt (10 characters)
- e.txt (21 characters)
What command can I use in the command line to only find files with a character count of exactly 21? In this case the command would return something like:
b.txt e.txt
Solution
Here's one approach ...
stat -c "%s %n" *txt | awk '$1=="21"{print $2}'
b.txt
e.txt
Answered By - tink