tags:

views:

24

answers:

2

i can use

ls|grep \.py$

to list all ends with .py file,but it's seems hard for me to grep all .py & .txt & .tar.gz file once

any one could give me a hand

+1  A: 
ls | grep -E '\.(py|txt|tar\.gz)$'
KennyTM
+1  A: 

No need external commands. Use the shell(bash/ksh)

shopt -s nullglob
for file in *.{txt,tar,gz,py}
do
  echo "$file"
done
ghostdog74
or even just: `ls *.{txt,tar,gz,py}`
glenn jackman
only when his purpose is just that, listing only.
ghostdog74