I want to pipeline the below commands but the last cmd "rm -rf"is not working i.e. Nothing deleted :
find /home/mba/Desktop/ -type d -name "logs" | sed 's/$/\/\*/' | rm -rf
No error is returned.
The rm
command doesn't take filenames from standard input. If you want to pipe from sed
to rm
, you can use xargs
. For example:
find /home/mba/Desktop/ -type d -name "logs" | sed 's/$/\/\*/' | xargs rm -rf