How to list Alphabetical Files and folders in Linux?
Some times it’s required to list only alphabetical file names when listing a directory. A small script will help you in getting this..
for i in *; do egrep '^[a-zA-Z]+$' <<<"$i"; done
Here we used reg-exp to grep only alphabets ie a-z and A-Z and nothing more than that.
As one of the blog user asked me the meaning of above command here is the explanation. You should know reg-exp to know about ^[a-zA-Z]+$ and <<< is called as hear string, this will pass word to the command, here the command is grep.
Latest posts by Surendra Anne (see all)
- Docker: How to copy files to/from docker container - June 30, 2020
- Anisble: ERROR! unexpected parameter type in action:
Fix - June 29, 2020 - FREE: JOIN OUR DEVOPS TELEGRAM GROUPS - August 2, 2019
- Review: Whizlabs Practice Tests for AWS Certified Solutions Architect Professional (CSAP) - August 27, 2018
- How to use ohai/chef-shell to get node attributes - July 19, 2018