shell - How to select files in a directory begins with explicit names in bash? -
i have shell script below
dcachedirin="/mypath/" files in `ls $dcachedirin | grep txt` ..... done
i have .txt files in directory, of them begins data2012*.txt , of data2011*.txt. how can choose "data2012" files?
edit: bad mixed python file. shell script sure.
you can try this
dcachedirin="/mypath/" files in `ls $dcachedirin | grep data2012` echo $files done
to avoid directories name, try
ls $dcachedirin -p | grep -v / | grep data2012
Comments
Post a Comment