Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How do I perform 2 commands within 1 line that the first perform action on the 2nd's result? For example, if I want to remove all the results of a certain path list given to me by "locate" (rm -rf > locate text.ext), how would I go about that?

share|improve this question
up vote 4 down vote accepted

You're not far off :) ... one way of doing it would be:

locate text.ext | xargs -i rm -rf "{}"
share|improve this answer
    
Worked like a charm. – user148366 Dec 21 '12 at 1:09

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.