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)
- 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
- wget download a file to a directory in Linux/Unix - June 4, 2018
- GIT: How to compare two GIT branches? - June 3, 2018