bashtube/code/common.sh

9 lines
247 B
Bash
Raw Normal View History

2022-11-29 20:12:23 +01:00
#jq_to_array(jq_expression)
function _jq_to_array() {
declare -ga "_tmp=($(jq -r "$1" | sed 's/[][`~!@#$%^&*():;<>.,?\|{}=+-]/\\&/g;'"s@\\\'@\\'@g" ))"
}
function format_numbers() {
rev | sed "s#[[:digit:]]\{3\}#&,#g" | rev | sed -E 's/^,//'
}