Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

3
  • @Rahul why the downvote? Commented Jul 25, 2016 at 10:21
  • I didn't downvote, but a couple of reasons the downvoter might have thought: 1. no need to use pipe-xargs, as find has the -exec or -execdir actions and 2. if you use pipe-xargs, at least do it in a way that won't fail with files with spaces or newlines in its name: find ... -print0 | xargs -0 sed ... (I don't know about the portability of this). Commented Jul 25, 2016 at 10:42
  • Given my reputation is too low to comment on the solution proposed by @John1024 I'll do it here, shouldn't that solution include the -type f to avoid processing any directories with the name 'file.txt', which was the main reason for my answer? the use of xargs was just to show another way... Commented Jul 25, 2016 at 10:54