I think I could pick apart about half of these and show how they aren't needed,
and the showpiece example is particularly weak since sed can do that do that entire pipeline itself in one shot, especially any version with -i.
You don't need either grep or sponge. Maybe sponge is still useful over simple shell redirection, but this example doesn't show it.
One of the other comments here suggests that the real point of sponge vs '>' is that it doesn't clobber the outoutput until the input is all read.
In that case maybe the problem is just that the description doesn't say anything about that. But even then there is still a problem, in that it should also stress that you must not unthinkingly do "sponge > file" because the > is done by the shell and not controlled by executable, and the shell may zero out the file immediately on parsing the line before any of the commands get to read it.
This makes sponge prone to unpleasant surprise because it leads the user to think it prevents something it actually has no power to prevent. The user still has to operate their shell correctly to get the result they want, just like without sponge.
So it's a footgun generator.
Maybe it's still actually useful enough to be worth writing and existing, but just needs some better example to show what the point is.
To me though, from what is shown, it just looks like an even worse example of the "useless use of cat" award, where you not only use cat for no reason, you also write a new cat for no reason and then use it for no reason.
But there is still something here. Some of these sound either good or at least near some track to being good.
Just a small comment about sponge: looking at the example, it's doing "sponge file", not "sponge > file". Given that, it's totally up to sponge to decide when it's going to open the output file.
I think I could pick apart about half of these and show how they aren't needed,
and the showpiece example is particularly weak since sed can do that do that entire pipeline itself in one shot, especially any version with -i.
You don't need either grep or sponge. Maybe sponge is still useful over simple shell redirection, but this example doesn't show it.
One of the other comments here suggests that the real point of sponge vs '>' is that it doesn't clobber the outoutput until the input is all read.
In that case maybe the problem is just that the description doesn't say anything about that. But even then there is still a problem, in that it should also stress that you must not unthinkingly do "sponge > file" because the > is done by the shell and not controlled by executable, and the shell may zero out the file immediately on parsing the line before any of the commands get to read it.
This makes sponge prone to unpleasant surprise because it leads the user to think it prevents something it actually has no power to prevent. The user still has to operate their shell correctly to get the result they want, just like without sponge.
So it's a footgun generator.
Maybe it's still actually useful enough to be worth writing and existing, but just needs some better example to show what the point is.
To me though, from what is shown, it just looks like an even worse example of the "useless use of cat" award, where you not only use cat for no reason, you also write a new cat for no reason and then use it for no reason.
But there is still something here. Some of these sound either good or at least near some track to being good.
I like it.