Reputation: 881
My C program creates output file out.txt.
I've to create md5sum of it.
I know that the command is md5sum out.txt > md5sum.txt
.
What I want is not to create whole out.txt and then md5sum out.txt
.
I want both operations to run parallely. Md5sum should be created while file is dumped. So that I could save some time.
Something like,
./program > out.txt &
md5sum out.txt > md5sum.txt &
wait
Is there a valid way to do this ? Please help.
Upvotes: 0
Views: 326
Reputation: 541
If you only want the checksum of file then you can use pipeline.
like ./program | md5sum > md5sum.txt
But in this way you will loose output file.
You can use following syntax
./program | tee > out.txt | md5sum > md5sum.txt
This will create out.txt file and also calculate md5sum whose output goes to md5sum.txt
Upvotes: 2
Reputation: 257
./program | md5sum > md5sum.txt
This should work for you :).
When you write A | B, both processes already run in parallel.
Upvotes: 1