Find command works on Linux but fails on Solaris.

Hi,

I am looking for a generic find command that works on both Linux and Solaris.

I have the below command that works fine on Linux but fails on solaris.

find /web/config -type f '(' -name '*.txt' -or -name '*.xml' -name '*.pro' ')'

Fails on SunOS mysolaris 5.10 Generic_150400-61 sun4v sparc sun4v

Error on Solaris:

Can you please suggest either the correct absolute path to find which works on both Linux & Solaris else tweak my command to suit both Linux and Solaris.

Try:

find /web/config -type f '(' -name '*.txt' -o -name '*.xml' -o -name '*.pro' ')'

Depending on what filename extensions are in use in the file hierarchy you're searching, you might even get what you want with just:

find /web/config -type f -name '*.[txp][xmr][tlo]'
1 Like