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 01-17-2004, 02:52 PM   #1
swingheim
LQ Newbie
 
Registered: Sep 2003
Posts: 10

Rep: Reputation: 0
Piping file list through rm


list contains:

0/a
0/b
0/c
1/a
1/b
1/c

I want to pipe that through the rm command, to delete each file in those directories The following command doesn't work:

Code:
cat list | rm -f
I want to do this on the command line (no perl, bash scripts, etc) and there are additional files in the 0/ and 1/ directories that need to remain in tact (a global rm -Rf * won't work here)

Any ideas?
 
Old 01-17-2004, 02:59 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,066
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
Have a good look at

man xargs



Cheers,
Tink
 
Old 01-17-2004, 05:12 PM   #3
willand
Member
 
Registered: Dec 2003
Location: Paris, France
Distribution: Debian, Knoppix & Mandrake
Posts: 52

Rep: Reputation: 15
i don't know if it is possible...
 
Old 01-17-2004, 05:24 PM   #4
swingheim
LQ Newbie
 
Registered: Sep 2003
Posts: 10

Original Poster
Rep: Reputation: 0
Oh, but it is

cat list | xargs rm -f

That worked just fine....

The original problem: I had setup some funny rules on our firewall to get around having to install a DNS server, and that caused EVERYONE hitting our email server to appear as if they were on the local network-- which opened our SMTP server up to the world....

I used that command to purge some 191,000 emails from the queue.

Whew!
 
Old 01-17-2004, 06:48 PM   #5
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,066
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
Quote:
cat list | xargs rm -f

That worked just fine....
Heh ...

Good on yah mate :)


Cheers,
Tink
 
  


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
list file name ust Linux - Software 4 12-07-2005 03:58 AM
Piping asx video to file Chen Linux - Newbie 2 01-07-2005 04:38 AM
Help!How can I get the file name list in C program? wuzhong Programming 6 09-22-2004 12:56 PM
C++ get file list Wynd Programming 2 06-09-2003 06:33 AM
Piping output to a text file joadoor Linux - Newbie 7 04-19-2002 04:50 AM


All times are GMT -5. The time now is 10:18 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