![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| question on find and remove command | arunkumar_mca | UNIX for Dummies Questions & Answers | 1 | 12-10-2007 09:54 PM |
| question about find command | hnhegde | UNIX for Dummies Questions & Answers | 4 | 10-26-2006 12:00 PM |
| how to find a file named vijay in a directory using find command | amirthraj_12 | UNIX for Dummies Questions & Answers | 5 | 10-25-2006 02:39 PM |
| Find command question | negixx | Shell Programming and Scripting | 6 | 07-08-2005 08:43 AM |
| command find returned bash: /usr/bin/find: Argument list too long | yacsil | Shell Programming and Scripting | 1 | 12-15-2003 02:38 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
|||
|
'find' command question
my solaris text talks about the 'find' command... it further goes to talk about an "action" used with the find command.
I am completely confused as to what the {} do with the find comand. the explanation is this: "A set of braces, {}, delimits where the file name is passed to the command from the prceding expressions." Now what does this mean? It makes no sense to me. an example they give is the following: $ find ~ -name core -exec rm {} \; |
| Forum Sponsor | ||
|
|
|
|||
|
Just answer your question about the {} braces.....
The braces become the result set from the find command....... so your rm {} will effectively do a "rm /dira/cor /dirb/core /dirc/core" Replacing the {} with all returned arguments from the find query. So for example if you wanted to cp the result of your search to a certain directory you could use: find . -name my_file -exec cp {} /export/home/all_my_files/ \; This would copy the file it found on the file system to your specified directory. Obviously for this you could only do it for a single return.....as if find retrieves multiple instances (as with your core search) then you'd be in a world of pain. If you want multiple things to be done...i.e. renaming the result files then you'd use the xargs command (RTM).
__________________
Pete |
|||
| Google The UNIX and Linux Forums |