The UNIX and Linux Forums  

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
Using cp -r command to selectively omit *.dat files while copying a directory. d_sai_kumar UNIX for Dummies Questions & Answers 5 07-18-2008 03:48 AM
Change All File Names in a Directory andou UNIX for Dummies Questions & Answers 8 01-22-2008 06:06 PM
Command to list directory names only stevefox UNIX for Dummies Questions & Answers 6 11-29-2007 05:06 PM
copying a file from one directory to another soujanya_srk UNIX for Dummies Questions & Answers 5 11-02-2007 02:40 AM
File and Directory Names become hidden dbinsol1 UNIX for Advanced & Expert Users 10 05-29-2002 06:58 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 11-17-2005
Registered User
 

Join Date: Oct 2005
Posts: 15
Red face Copying file names returned from a grep command into another directory

When I do the following :

grep -l "string" *,

I get a list of file names returned. Is there a way to copy the files returned from the list into another directory ?.

Thanks.

Last edited by Kartheg; 11-17-2005 at 08:54 AM.
Reply With Quote
Forum Sponsor
  #2  
Old 11-17-2005
Registered User
 

Join Date: Nov 2005
Location: cyberjaya
Posts: 85
$ cp `grep -l "string" *` tmp/
Reply With Quote
  #3  
Old 11-17-2005
Registered User
 

Join Date: Oct 2005
Posts: 15
I get the following :-

cp:cannot access grep -l string *
Reply With Quote
  #4  
Old 11-17-2005
Registered User
 

Join Date: Oct 2002
Posts: 676
Make sure you are using backticks (above the tab key on a standard keyboard).
Reply With Quote
  #5  
Old 11-17-2005
Registered User
 

Join Date: Oct 2005
Posts: 15
Yes, That works !

Thank you ashterix & dangral for your help.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 01:04 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0