LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 11-06-2003, 06:05 PM   #1
ooagentbender
Member
 
Registered: Sep 2003
Distribution: Vector Linux
Posts: 110

Rep: Reputation: 15
need a script desperatly...


Hey I know there are tons of you out there with lotsa unix knowledge so i was hoping you could help me out with a script that will search through a file and all its sub files and find any files contained there in with a " 1 " all by itself in the name just like in the quotes and delete it.

thanks a ton!
 
Old 11-06-2003, 06:11 PM   #2
jim mcnamara
Member
 
Registered: May 2002
Posts: 964

Rep: Reputation: 35
try -
cd to the directory with the files you want to clobber
Code:
find .  -name '* 1 *' -ok rm {} \;
 
Old 11-06-2003, 06:13 PM   #3
mossy
Member
 
Registered: Aug 2003
Location: USexIRL
Distribution: *nix
Posts: 849

Rep: Reputation: 30
kewl - I could not figure out what to do after it found it. Also I thought this will only find filenames and not actually search the file contents???


[edit]

Also how do you make it a ./ file??

Last edited by mossy; 11-06-2003 at 06:15 PM.
 
Old 11-06-2003, 06:41 PM   #4
ooagentbender
Member
 
Registered: Sep 2003
Distribution: Vector Linux
Posts: 110

Original Poster
Rep: Reputation: 15
ok that works PERFECT! thanks so much. Is there any way to have it automatically delete the files without me having to answer y and hit enter when it finds one? AND does anyone know who you would access a firewire hard drive in the terminal of os x??

Last edited by ooagentbender; 11-06-2003 at 06:45 PM.
 
Old 11-06-2003, 06:51 PM   #5
bitva
Member
 
Registered: Dec 2002
Location: Los Angeles
Distribution: Debian
Posts: 72

Rep: Reputation: 15
try putting a \ before the rm command: \rm

not sure about the hard drive question though. sorry.
 
Old 11-06-2003, 06:55 PM   #6
ooagentbender
Member
 
Registered: Sep 2003
Distribution: Vector Linux
Posts: 110

Original Poster
Rep: Reputation: 15
the \ before the rm didn't work but thanks anyway
 
Old 11-06-2003, 07:07 PM   #7
bitva
Member
 
Registered: Dec 2002
Location: Los Angeles
Distribution: Debian
Posts: 72

Rep: Reputation: 15
well, then go all-balls-out and do:

find . -name '* 1 *' -ok rm -f {} \;
 
Old 11-06-2003, 07:13 PM   #8
ooagentbender
Member
 
Registered: Sep 2003
Distribution: Vector Linux
Posts: 110

Original Poster
Rep: Reputation: 15
still didn't work....
 
Old 11-06-2003, 08:43 PM   #9
jim mcnamara
Member
 
Registered: May 2002
Posts: 964

Rep: Reputation: 35
change the -ok to -exec

ok runs exec if you answer yes.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Shutting down (Need help Desperatly) Cybermagellan Linux - Software 4 03-15-2005 05:22 PM
Trying desperatly to install MPlayer swimfaster Linux - Software 5 08-25-2004 08:26 PM
CM8738 6 Channel Problem Need help Desperatly! Boffy Linux - Hardware 0 12-13-2003 09:19 AM
Desperatly need Help: SNAFU SpookMonkey Linux - General 9 02-13-2003 06:20 AM
Im trying to write a script or prog (newbie needs help desperatly!) bripage Programming 19 08-10-2002 10:06 AM


All times are GMT -5. The time now is 01:06 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration