writting to disk and compress with xz at the same timeHow to convert all files from gzip to xz on the fly (and recursively)?How can I tell if the pipe buffer is full?Use time ,timeout and ulimit commands properlyNamed pipes: several experiments leads to confusiongrep script - output lines at the same time into echoCan a pipe be used instead of exec in - find / -name “.txt” -exec cp /junk ;On-the-fly stream compression that doesn't spill over into hardware resources?Pipe limit data in bytesHow to concatenate results of multiple commands and pipe into another without intermediate file?Tee does not write to file when combined to pipestderr stdout to log with date and time also show output to tty but without date and time
Why doesn't Anakin's lightsaber explode when it's chopped in half on Geonosis?
How would someone destroy a black hole that’s at the centre of a planet?
Deep Learning based time series forecasting
Can I activate an iPhone without an Apple ID?
Krazy language in Krazy Kat, 25 July 1936
What is the German equivalent of 干物女 (dried fish woman)?
Commutator subgroup of Heisenberg group.
Are lithium batteries allowed in the International Space Station?
How can I legally visit the United States Minor Outlying Islands in the Pacific?
What impact would a dragon the size of Asia have on the environment?
Why does ffmpeg choose 10+20+20ms instead of an even 16ms for 60fps gifs?
Can someone explain this logical statement?
Old short story where the future emperor of the galaxy is taken for a tour around Earth
Why do legislative committees exist?
What caused Windows ME's terrible reputation?
Spider-Man: Far From Home - Why do they take a detour to Dorset?
3D-Plot with an inequality condition for parameter values
Possible isometry groups of open manifolds
Align by center of symbol
Do native speakers use ZVE or CPU?
How would you write do the dialogues of two characters talking in a chat room?
What are some symbols representing peasants/oppressed persons fighting back?
Could the crash sites of the Apollo 11 and 16 LMs be seen by the LRO?
Project Euler, problem # 9, Pythagorean triplet
writting to disk and compress with xz at the same time
How to convert all files from gzip to xz on the fly (and recursively)?How can I tell if the pipe buffer is full?Use time ,timeout and ulimit commands properlyNamed pipes: several experiments leads to confusiongrep script - output lines at the same time into echoCan a pipe be used instead of exec in - find / -name “.txt” -exec cp /junk ;On-the-fly stream compression that doesn't spill over into hardware resources?Pipe limit data in bytesHow to concatenate results of multiple commands and pipe into another without intermediate file?Tee does not write to file when combined to pipestderr stdout to log with date and time also show output to tty but without date and time
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I have a program and writes traces on disk and the size becomes very large. Normally, I use
./run output.txt
xz output.txt
I want to know if I can pipe xz at the same time as output.txt is being written. I see this topic, but not sure it is applicable for me.
bash pipe xz
add a comment |
I have a program and writes traces on disk and the size becomes very large. Normally, I use
./run output.txt
xz output.txt
I want to know if I can pipe xz at the same time as output.txt is being written. I see this topic, but not sure it is applicable for me.
bash pipe xz
1
See if your ./run tool can write its output to stdout instead of a file. The answer depends on that.
– Janka
8 hours ago
add a comment |
I have a program and writes traces on disk and the size becomes very large. Normally, I use
./run output.txt
xz output.txt
I want to know if I can pipe xz at the same time as output.txt is being written. I see this topic, but not sure it is applicable for me.
bash pipe xz
I have a program and writes traces on disk and the size becomes very large. Normally, I use
./run output.txt
xz output.txt
I want to know if I can pipe xz at the same time as output.txt is being written. I see this topic, but not sure it is applicable for me.
bash pipe xz
bash pipe xz
asked 8 hours ago
mahmoodmahmood
3992 gold badges8 silver badges23 bronze badges
3992 gold badges8 silver badges23 bronze badges
1
See if your ./run tool can write its output to stdout instead of a file. The answer depends on that.
– Janka
8 hours ago
add a comment |
1
See if your ./run tool can write its output to stdout instead of a file. The answer depends on that.
– Janka
8 hours ago
1
1
See if your ./run tool can write its output to stdout instead of a file. The answer depends on that.
– Janka
8 hours ago
See if your ./run tool can write its output to stdout instead of a file. The answer depends on that.
– Janka
8 hours ago
add a comment |
1 Answer
1
active
oldest
votes
If your ./run
will produce its output to stdout if not given a file argument (which is customary in Unix/Linux), then you can simply use:
./run | xz -c >output.txt.xz
If it needs a filename argument, but if it's fine writing to a pipe, then you can either use a special device such as /dev/stdout
or /dev/fd/1
(both should be equivalent), like so:
./run /dev/stdout | xz -c >output.txt.xz
Or you can use process substitution, which is typically available in most modern shells such as bash, zsh, or ksh, which will end up using a device from /dev/fd
behind the scenes to accomplish the same:
./run >(xz -c >output.txt.xz)
This last one also needs ./run
to be able to write to a pipe, but it should work better than the others if ./run
writes to output.txt
and to stdout in its normal operation, in which case the output would get mixed up if you redirect both to stdout.
Programs are usually ok writing to a pipe, but some of them might want to seek and rewind to offsets within an output file, which is not possible in a pipe. If that's the case, then writing to a temporary file and then compressing it is probably all you can do.
add a comment |
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/3.0/"u003ecc by-sa 3.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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f530148%2fwritting-to-disk-and-compress-with-xz-at-the-same-time%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
If your ./run
will produce its output to stdout if not given a file argument (which is customary in Unix/Linux), then you can simply use:
./run | xz -c >output.txt.xz
If it needs a filename argument, but if it's fine writing to a pipe, then you can either use a special device such as /dev/stdout
or /dev/fd/1
(both should be equivalent), like so:
./run /dev/stdout | xz -c >output.txt.xz
Or you can use process substitution, which is typically available in most modern shells such as bash, zsh, or ksh, which will end up using a device from /dev/fd
behind the scenes to accomplish the same:
./run >(xz -c >output.txt.xz)
This last one also needs ./run
to be able to write to a pipe, but it should work better than the others if ./run
writes to output.txt
and to stdout in its normal operation, in which case the output would get mixed up if you redirect both to stdout.
Programs are usually ok writing to a pipe, but some of them might want to seek and rewind to offsets within an output file, which is not possible in a pipe. If that's the case, then writing to a temporary file and then compressing it is probably all you can do.
add a comment |
If your ./run
will produce its output to stdout if not given a file argument (which is customary in Unix/Linux), then you can simply use:
./run | xz -c >output.txt.xz
If it needs a filename argument, but if it's fine writing to a pipe, then you can either use a special device such as /dev/stdout
or /dev/fd/1
(both should be equivalent), like so:
./run /dev/stdout | xz -c >output.txt.xz
Or you can use process substitution, which is typically available in most modern shells such as bash, zsh, or ksh, which will end up using a device from /dev/fd
behind the scenes to accomplish the same:
./run >(xz -c >output.txt.xz)
This last one also needs ./run
to be able to write to a pipe, but it should work better than the others if ./run
writes to output.txt
and to stdout in its normal operation, in which case the output would get mixed up if you redirect both to stdout.
Programs are usually ok writing to a pipe, but some of them might want to seek and rewind to offsets within an output file, which is not possible in a pipe. If that's the case, then writing to a temporary file and then compressing it is probably all you can do.
add a comment |
If your ./run
will produce its output to stdout if not given a file argument (which is customary in Unix/Linux), then you can simply use:
./run | xz -c >output.txt.xz
If it needs a filename argument, but if it's fine writing to a pipe, then you can either use a special device such as /dev/stdout
or /dev/fd/1
(both should be equivalent), like so:
./run /dev/stdout | xz -c >output.txt.xz
Or you can use process substitution, which is typically available in most modern shells such as bash, zsh, or ksh, which will end up using a device from /dev/fd
behind the scenes to accomplish the same:
./run >(xz -c >output.txt.xz)
This last one also needs ./run
to be able to write to a pipe, but it should work better than the others if ./run
writes to output.txt
and to stdout in its normal operation, in which case the output would get mixed up if you redirect both to stdout.
Programs are usually ok writing to a pipe, but some of them might want to seek and rewind to offsets within an output file, which is not possible in a pipe. If that's the case, then writing to a temporary file and then compressing it is probably all you can do.
If your ./run
will produce its output to stdout if not given a file argument (which is customary in Unix/Linux), then you can simply use:
./run | xz -c >output.txt.xz
If it needs a filename argument, but if it's fine writing to a pipe, then you can either use a special device such as /dev/stdout
or /dev/fd/1
(both should be equivalent), like so:
./run /dev/stdout | xz -c >output.txt.xz
Or you can use process substitution, which is typically available in most modern shells such as bash, zsh, or ksh, which will end up using a device from /dev/fd
behind the scenes to accomplish the same:
./run >(xz -c >output.txt.xz)
This last one also needs ./run
to be able to write to a pipe, but it should work better than the others if ./run
writes to output.txt
and to stdout in its normal operation, in which case the output would get mixed up if you redirect both to stdout.
Programs are usually ok writing to a pipe, but some of them might want to seek and rewind to offsets within an output file, which is not possible in a pipe. If that's the case, then writing to a temporary file and then compressing it is probably all you can do.
answered 7 hours ago
filbrandenfilbranden
12.4k2 gold badges22 silver badges52 bronze badges
12.4k2 gold badges22 silver badges52 bronze badges
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f530148%2fwritting-to-disk-and-compress-with-xz-at-the-same-time%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
1
See if your ./run tool can write its output to stdout instead of a file. The answer depends on that.
– Janka
8 hours ago