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
Moving files not directory. senthil_is Shell Programming and Scripting 1 05-09-2008 02:21 AM
Moving specific files Stud33 Shell Programming and Scripting 4 03-31-2007 10:50 PM
Moving Files iAm4Free Shell Programming and Scripting 5 03-28-2007 05:13 AM
moving between vi files aya_r Shell Programming and Scripting 2 08-23-2005 05:36 AM
moving files ?? rocker40 UNIX for Dummies Questions & Answers 9 11-09-2003 08:36 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 Rating: Thread Rating: 1 votes, 4.00 average. Display Modes
  #1 (permalink)  
Old 11-19-2001
sskb
Guest
  
 

Posts: n/a
Bits: 0 [Banking]
moving only files...

hi.. I want to move a set of files that contain a particular string. I wished to do that with find but i am unable to do that. can anybody give me a good method?
  #2 (permalink)  
Old 11-19-2001
doeboy's Avatar
doeboy doeboy is offline
Registered User
  
 

Join Date: Oct 2001
Location: Here
Posts: 137
You could try using wildcards. That might get you what you want.

Example:
mv *string* <destination>
  #3 (permalink)  
Old 11-19-2001
sskb
Guest
  
 

Posts: n/a
Bits: 0 [Banking]
I'm sorry I'm afraid that you understood my query in some other way. I meant files containing particular string and not filenames.

for example..
i want some files which contain the line

'I love unix'

  #4 (permalink)  
Old 11-19-2001
doeboy's Avatar
doeboy doeboy is offline
Registered User
  
 

Join Date: Oct 2001
Location: Here
Posts: 137
Sorry... my bad...

You can try using "grep -l" to help you find the files containing the string, and use that list to base what you want moved on. "grep -l" will print the filenames containing the string you're looking for.
  #5 (permalink)  
Old 11-19-2001
Jimbo
Guest
  
 

Posts: n/a
Bits: 0 [Banking]
If the files to be searched are in one directory, you can list the filesnames with:

grep -l 'I love unix' *

If you want to move all to one directory, then:

mv `grep -l 'I love unix' *` /u01/myotherdir

or process each file one-by-one:

for filename in `grep -l 'I love unix' *`
do
echo "Now processing $filename ..."
<whatever>
done
  #6 (permalink)  
Old 11-19-2001
Jimbo
Guest
  
 

Posts: n/a
Bits: 0 [Banking]
Sorry doeboy, I see now that you have covered it. Your reply was not visible when I replied.
  #7 (permalink)  
Old 11-19-2001
doeboy's Avatar
doeboy doeboy is offline
Registered User
  
 

Join Date: Oct 2001
Location: Here
Posts: 137
It's alright...

as long as we the person who's asking for help gets what he/she wanted, it's all good.

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 02:20 AM.


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