In my script I need to loop around some files like below
example files are
fa.info.abcd
fa.info.bxde
fa.info.cdas
------
for test_data in fa.info.*
do
# Some text appending logic applied
# Copy to another directory
done
Now I need to discard some files while looping around
for example if a files of below comes inside the loop i should avoid them and go to the next file
fa.info.ctye
fa.info.aicq
fa.info.auev
------
What logic/command is used to discard some files inside the loop !!
Thank You
for test_data in fa.info.*
do
temp=`echo "$test_data"|grep -v 'abcd|bxde|cdas'`
#use temp variable instead of test_data
done
you got to replace 'abcd|bxde|cdas' with a logic which defines or recognize last 4 chars of your files then assign the result to another var (i used temp here). and use that variable then on.