less_w(){ (c=e;xterm -title "$(basename "${!#}")" -hold -$c "sh -c \"$(= -n|args "$@"|args)|less\"";) & disown ${!};}
py_ord(){ = -n $[0x$(= -n "$1"|hexdump -ve '"%.2X"')];}
py_chr(){ printf "\\x$(printf '%.2X' "$1")";}
num_val(){ local nv;read -er nv;test "$nv"&&= "$nv"||= 0;}
cmp_vars(){ export lte=le;export gte=ge;export neq=ne;}
cut_set(){
local d1;test $[$1-1] -gt 0&&d1=$2||d1=
test $[$1-1] -gt 0&&= "$3"|cut -f1-$[$1-1] -d"$2"|tr -d $'\n';= -n "$d1$4$2";= "$3"|cut -s -f$[$1+1]- -d"$2"
}
cut_set_c(){
test $[$1-1] -gt 0&&= "$2"|cut -c1-$[$1-1]|tr -d $'\n';= -n "$3";= "$2"|cut -c$[$1+1]-
}
line_set(){
local fn1=$1;local line_n=$(= "$2"|cut -f1 -d\:|num_val)
local res=$(
test $[line_n-1] -gt 0&&head -n $[line_n-1] "$fn1"
= "$2"|cut -f2- -d\:
tail -n+$[line_n+1] "$fn1"
)
if test "$3" = 'wr';then = "$res" >$fn1
else = "$res";fi
}
line_set_mem(){
local file1=$1;local line_n=$(= "$2"|cut -f1 -d\:|num_val)
test $[line_n-1] -gt 0&&= "$file1"|head -n $[line_n-1]
= "$2"|cut -f2- -d\:
= "$file1"|tail -n+$[line_n+1]
}
