find a file in a location with specific text in file name and do some operation using shell script

Viewed 23

at a particular location there are many file name as:

abc.spf
cat.spf
earth_ghu.spf
animal.spf
mars_ghu.spf

my code is as follows:

     setenv SPF_PATH_TEMP ./spf_temp
     set array = $SPF_PATH_TEMP/*.spf
    
     foreach spf_file ( $array )
            if (${spf_file} != "*ghu.spf") then
            echo ${spf_file}
            endif
         end

i want to do the operation in the foreach loop when the file does not contain the "ghu" in the file name. But my code does not working .... i think it cant understand "*" in the if statement.

Please provide me some solution.

thank you

0 Answers
Related