Grep for a particular file in a directory
Posted on 2012-04-10
I am finding the text files in a particular directory, which is having any one of the names
['BAH','FOR','OSA','INT','CAB','MIN','IND','NAT','APO'] and then finding teh base name of it.
My problem being I am getting all the text files in the directory, even though their names didn't match the list.
for FF in `ls $SCRIPT_DIR/*.txt | grep -i "['BAH','FOR','OSA','INT','CAB','MIN','IND','NAT','APO']"`
File=`echo $F | sed "s/\..*$//"`
My shell version is :
GNU bash, version 3.2.16(1)-release (powerpc-ibm-aix184.108.40.206)