Last active
April 21, 2020 22:46
-
-
Save szarnyasg/c7779043169eb6c7f46df3405cd2c7b5 to your computer and use it in GitHub Desktop.
Save space for in-place sed with zstd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# compress $FILE with zstdmt | |
# remove $FILE | |
# print the header, decompress $FILE.zst afterwards and write them into $FILE | |
# delete $FILE.zst | |
FILE=myfile; zstdmt $FILE -f && rm $FILE && echo NEW_HEADER | cat - <(unzstd -c $FILE.zst | tail -n +2) > $FILE && rm $FILE.zst |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# compress $FILE with zstdmt | |
# remove $FILE | |
# decompress $FILE.zst and perform the sed operation (substituting "FROM" to "TO") | |
# delete $FILE.zst | |
FILE=myfile; zstdmt $FILE -f && rm $FILE && unzstd -c $FILE.zst | sed 's/FROM/TO/' > $FILE && rm $FILE.zst |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment