Operating System - HP-UX
1833776 Members
2003 Online
110063 Solutions
New Discussion

Re: find arg list to long

 
SOLVED
Go to solution
MikeL_4
Super Advisor

find arg list to long

When I issue a find cimmand from the command line it works fine:

find /Apps/applmgr/lib/* -type f -print |awk -F / {'print $8, $9, $10}' >> FILE_LIST

but when I put it within a shell script I receive a message:
find arg list to long

Any ideas as to why and how to get around it ??

Thanks
5 REPLIES 5
James R. Ferguson
Acclaimed Contributor

Re: find arg list to long

Hi:

The shell is expanding the "*" character before the 'find' is executed. Place double quote marks around the argument:

# find "/Apps/applmgr/lib/*" ...

Better yet, in this case, drop the "/*" part. Your 'find' command will search the directory (and its decendents) for files therein.

Regards!

...JRF...
Jose Mosquera
Honored Contributor

Re: find arg list to long

Hi,

If you're ussing "/" cahracter like awk's field separator, the correct sintax must be:

#find /Apps/applmgr/lib/* -type f -print |awk -F"/" {'print $8, $9, $10}' >> FILE_LIST

Rgds.
MikeL_4
Super Advisor

Re: find arg list to long

Thanks, the answer worked like a charm...

When using the find command is
there an argument you can use so it WILL NOT search through subdirectories ??
John Dvorchak
Honored Contributor

Re: find arg list to long

To add to the others comments when you include the "/*" in the find command you are also limiting the search to all files that DO NOT start with a "." and that is ok if that is your intent. If it is then you have in escape the * with a \ to get it to work as intended in a script i.e.

find /Aps/applmgr/lib/\* -type f -print .........

If it has wheels or a skirt, you can't afford it.
Chris Vail
Honored Contributor
Solution

Re: find arg list to long

You asked if there is a way to stop the "find" command from descending any sub directories. Yes, it is the "-prune" argument.

Chris