xargs + sed

I always forget how to chain xargs w/ sed. I use it so rarely that I always have to look it up again. Here its an example for future reference. Note that the command is `sed -i single quote single quote` not a double quote.

find . -name Makefile | xargs sed -i ” -e ‘s/–parents/-p/’

2 Responses to “xargs + sed”

  1. Scott says:

    BTW you can skip xargs with find by using -exec if you were so inclined to do so = ]

    find . -name Makefile -exec sed -i ” -e ‘s/-parents/-p/’ {} \;

    Don’t you know that Makefiles are so old school now. The ants ate them. hahaha

  2. ejohnson says:

    haha I heard we’re switching to ANT. I hate makefiles so I’m perfectly ok with that.

Leave a Reply