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.

 

The following two tabs change content below.
Mr Surendra Anne is from Vijayawada, Andhra Pradesh, India. He is a Linux/Open source supporter who believes in Hard work, A down to earth person, Likes to share knowledge with others, Loves dogs, Likes photography. He works as Devops Engineer with Taggle systems, an IOT automatic water metering company, Sydney . You can contact him at surendra (@) linuxnix dot com.