LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 12-23-2006, 05:29 PM   #1
JussiKp
Member
 
Registered: Aug 2006
Posts: 49

Rep: Reputation: 15
Formatting output of find suitable for rm


I'd like to remove all mp3-files in /mnt/foo.

I tried find -iname "*.mp3" | replace ' ' '\ ' ' | rm -f etc, but it did not work. Of course I have to replace '(' with '\(' etc and maybe remove line feeds but how should I do it, is there some easy solution?
 
Old 12-23-2006, 05:45 PM   #2
raskin
Senior Member
 
Registered: Sep 2005
Location: Russia
Distribution: NixOS (http://nixos.org)
Posts: 1,893

Rep: Reputation: 68
Eh... You meant 'xargs rm -f' and no escaping, or you have mp3's with CR in name?

That is
echo filename1 filename2 | xargs rm
 
Old 12-23-2006, 11:29 PM   #3
JussiKp
Member
 
Registered: Aug 2006
Posts: 49

Original Poster
Rep: Reputation: 15
File paths in folders contain whitespaces, braces etc, e.g. /mnt/foo/Some random folder (2006)/file.mp3.
 
Old 12-24-2006, 03:00 AM   #4
raskin
Senior Member
 
Registered: Sep 2005
Location: Russia
Distribution: NixOS (http://nixos.org)
Posts: 1,893

Rep: Reputation: 68
For xargs only carriage returns matter. Everything else is ok.
 
  


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
Formatting output krock923 Programming 2 06-07-2006 07:26 AM
Need help to find a suitable CMS clau_bolson Linux - Software 5 02-13-2006 11:22 PM
formatting date output grob115 Linux - Newbie 2 01-28-2006 08:03 AM
Formatting output of ls doodar Linux - Newbie 29 07-29-2004 01:25 PM
need hlp formatting output from ls test* Evan P. Programming 1 11-06-2003 08:40 PM


All times are GMT -5. The time now is 11:47 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration