Is there a standard alternative to sponge to pipe a file into itself?Pipe diff file into patch?Is there a way...

Creating specific options in `Manipulate[]`

How is the Apple Watch ECG disabled in certain countries?

Fix Ethernet 10/100 PoE cable with 7 out of 8 wires alive

How to compare integers in Tex?

How deep is the liquid in a half-full hemisphere?

As a team leader is it appropriate to bring in fundraiser candy?

I transpose the source code, you transpose the input!

How important is knowledge of trig identities for use in Calculus

Would allowing versatile weapons wielded in two hands to benefit from Dueling be unbalanced?

Why does it seem the best way to make a living is to invest in real estate?

Top off gas with old oil, is that bad?

How to translate "it's right to leave this world better than you found it"?

Did Tolkien ever write about a Heaven or Hell for Men?

What would happen if I build a half bath without permits?

Can you cure a Gorgon's Petrifying Breath before it finishes turning a target to stone?

If a spaceship ran out of fuel somewhere in space between Earth and Mars, does it slowly drift off to the Sun?

What action is recommended if your accommodation refuses to let you leave without paying additional fees?

Worlds with different mathematics and logic

Can an energy drink or chocolate before an exam be useful ? What sort of other edible goods be helpful?

How many stack cables would be needed if we want to stack two 3850 switches

Why do Russians sometimes spell "жирный" (fatty) as "жырный"?

Can the President of the US limit First Amendment rights?

Would an object shot from earth fall into the sun?

GPLv3 forces us to make code available, but to who?



Is there a standard alternative to sponge to pipe a file into itself?


Pipe diff file into patch?Is there a way to pipe the output of one program into two other programs?How can I pipe commands to any terminal?How to use a bash function like a regular command in a pipe chain?Logging bash output to a filePipe a .BIN file into XModem transferRedirecting output of running process via SSH in backgroundRedirection and piping for greppingWhat is the best way to direct stdout & stderr to multiple logfiles?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







0















I frequently want to do something like this:



 cat file | command > file


(which obviously doesn't work). The only solution I've seen for this is sponge, i.e.



 cat file | command | sponge file


Unfortunately, sponge is not available to me (nor can I install it or any other package).



Is there a more standard quick way to do this without having to break it up every time into multiple commands (pipe to temp file, pipe back to original, delete temp file)? I tried tee for example, and it seems to work, but is it a consistent/safe solution?










share|improve this question




















  • 1





    If there were a more standard way, sponge wouldn't have had to exist. If you can't install a package, can you create the corresponding shell script to use? (x=$(mktemp); cat > "$x" ; mv "$x" "$1")

    – Michael Homer
    2 hours ago


















0















I frequently want to do something like this:



 cat file | command > file


(which obviously doesn't work). The only solution I've seen for this is sponge, i.e.



 cat file | command | sponge file


Unfortunately, sponge is not available to me (nor can I install it or any other package).



Is there a more standard quick way to do this without having to break it up every time into multiple commands (pipe to temp file, pipe back to original, delete temp file)? I tried tee for example, and it seems to work, but is it a consistent/safe solution?










share|improve this question




















  • 1





    If there were a more standard way, sponge wouldn't have had to exist. If you can't install a package, can you create the corresponding shell script to use? (x=$(mktemp); cat > "$x" ; mv "$x" "$1")

    – Michael Homer
    2 hours ago














0












0








0








I frequently want to do something like this:



 cat file | command > file


(which obviously doesn't work). The only solution I've seen for this is sponge, i.e.



 cat file | command | sponge file


Unfortunately, sponge is not available to me (nor can I install it or any other package).



Is there a more standard quick way to do this without having to break it up every time into multiple commands (pipe to temp file, pipe back to original, delete temp file)? I tried tee for example, and it seems to work, but is it a consistent/safe solution?










share|improve this question














I frequently want to do something like this:



 cat file | command > file


(which obviously doesn't work). The only solution I've seen for this is sponge, i.e.



 cat file | command | sponge file


Unfortunately, sponge is not available to me (nor can I install it or any other package).



Is there a more standard quick way to do this without having to break it up every time into multiple commands (pipe to temp file, pipe back to original, delete temp file)? I tried tee for example, and it seems to work, but is it a consistent/safe solution?







pipe tee






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked 2 hours ago









argentum2fargentum2f

1316 bronze badges




1316 bronze badges











  • 1





    If there were a more standard way, sponge wouldn't have had to exist. If you can't install a package, can you create the corresponding shell script to use? (x=$(mktemp); cat > "$x" ; mv "$x" "$1")

    – Michael Homer
    2 hours ago














  • 1





    If there were a more standard way, sponge wouldn't have had to exist. If you can't install a package, can you create the corresponding shell script to use? (x=$(mktemp); cat > "$x" ; mv "$x" "$1")

    – Michael Homer
    2 hours ago








1




1





If there were a more standard way, sponge wouldn't have had to exist. If you can't install a package, can you create the corresponding shell script to use? (x=$(mktemp); cat > "$x" ; mv "$x" "$1")

– Michael Homer
2 hours ago





If there were a more standard way, sponge wouldn't have had to exist. If you can't install a package, can you create the corresponding shell script to use? (x=$(mktemp); cat > "$x" ; mv "$x" "$1")

– Michael Homer
2 hours ago










0






active

oldest

votes














Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});















draft saved

draft discarded
















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f543541%2fis-there-a-standard-alternative-to-sponge-to-pipe-a-file-into-itself%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes

















draft saved

draft discarded



















































Thanks for contributing an answer to Unix & Linux Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f543541%2fis-there-a-standard-alternative-to-sponge-to-pipe-a-file-into-itself%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Hudson River Historic District Contents Geography History The district today Aesthetics Cultural...

The number designs the writing. Feandra Aversely Definition: The act of ingrafting a sprig or shoot of one...

Ayherre Geografie Demografie Externe links Navigatiemenu43° 23′ NB, 1° 15′ WL43° 23′ NB, 1°...