The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



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 !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
how to find a file named vijay in a directory using find command amirthraj_12 UNIX for Dummies Questions & Answers 6 10-25-2008 01:37 PM
question on find and remove command arunkumar_mca UNIX for Dummies Questions & Answers 1 12-11-2007 01:54 AM
question about find command hnhegde UNIX for Dummies Questions & Answers 4 10-26-2006 04:00 PM
Find command question negixx Shell Programming and Scripting 6 07-08-2005 12:43 PM
command find returned bash: /usr/bin/find: Argument list too long yacsil Shell Programming and Scripting 1 12-15-2003 06:38 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 03-06-2002
xyyz xyyz is offline
Registered User
  
 

Join Date: Sep 2001
Posts: 114
'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 {} \;
  #2 (permalink)  
Old 03-07-2002
TioTony's Avatar
TioTony TioTony is offline Forum Advisor  
Bit Pusher
  
 

Join Date: Oct 2001
Location: Southern California
Posts: 332
Basically it just means find is going to pass the files it found to what ever command you specify. In your example, find going to locate core files and send them as output to the rm command. It's just a fancy way to find stuff and delete it at the same time.
  #3 (permalink)  
Old 03-07-2002
peter.herlihy peter.herlihy is offline
Registered User
  
 

Join Date: Nov 2001
Location: New Zealand
Posts: 333
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).
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 08:04 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0