2 exec in find

Guys,

I want to find the log files greather than 23 days and i want to perform 2 things here.

one is to list the files and second is to gzip the files. hope this can be done using sh -c option. but not sure the exact command.

 
find . -name "*.log" -mtime +23 -exec ls -la {} \; 

Could you please help me on this?

Thanks,

man find:

Try

find . -name "*.log" -mtime +23 -ls -exec gzip {} \;

This one did not work..

You can have many -exec

find . -type f -name "*.log" -mtime +23 -exec ls -l {} \; -exec gzip {} \;

can i use this command inside the shell script?

Sure:

#!/bin/sh
cd /dir/with/logfiles/ &&
find . ...

Don't forget to make this executable with chmod 755 shellscript .
NB the && ensures that the find is run only when the cd was successful.