Quoted Printable encode/decode bash aliases - suitable for pipelining
# To decode: | |
# qp -d string | |
# To encode: | |
# qp string | |
alias qpd='perl -MMIME::QuotedPrint -pe '\''$_=MIME::QuotedPrint::decode($_);'\''' | |
alias qpe='perl -MMIME::QuotedPrint -pe '\''$_=MIME::QuotedPrint::encode($_);'\''' | |
function qp { | |
if [[ "$1" = "-d" ]] | |
then | |
echo ${@:2} | qpd | |
else | |
echo ${@} | qpe | |
fi | |
} |
This comment has been minimized.
This comment has been minimized.
Good call, thanks! I tend to use them mostly in one liners so I can pipeline to other tools easily, but that's a good point worth noting. |
This comment has been minimized.
This comment has been minimized.
Alternatively, use Python's
|
This comment has been minimized.
This comment has been minimized.
@Hubro: this should be the accepted answer! (oh wait, I'm not on stackoverflow?) |
This comment has been minimized.
This comment has been minimized.
the perl version can be much simple:
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This comment has been minimized.
Don't forget to "shopt -s expand_aliases" if you plan to use these aliases in bash scripts