multiple condition matching and doing some predefined work

Hi everybody,

I had 10 files in in one folder(/home/sai/) namely sai.
1.gz,2.gz,3.gz ..,10.gz.

I want to delete the files which are there home based on the following conditions

fliecount in sai folder==10 && grep -cv ".gz"==0

How to check this using awk?

Otherwise please suggest a best method for doing it?

From where you want to delete the files?
From which files you want to grep ".gz"? I guess its file names and not the contents.

Please rephrase your requirement and give us more details with the clear example.

Hi anchal,

I had 5 files in in one folder(/home/sai/) namely sai.

>cd /home/sai
>ls
1.gz 2.gz 3.gz 4.gz 5.gz

I want to delete the files which are there in home directory, if filecount in sai directory is 5 and also all files should be in *.gz format.

>pwd
/home/sai

'ls | wc -l`==5 && `ls | grep -cv ".gz"`==0

How to check this using awk?

Otherwise please suggest a best method for doing it?