matrix-script icon indicating copy to clipboard operation
matrix-script copied to clipboard

I like your code.

Open PaS3 opened this issue 4 years ago • 0 comments

I added this to quickly store every char sample in one line and script.

#GPL-2.0 License 

kota="$(for ich in A B C D E F;do for yo in $(seq 0 9) A B C D E F ;do echo -e "\\u30${ich}${yo}";done;done)"

askee="$(for k in 4 5 ;do for i in {0..9} A ;do if [[ "${k}${i}" == "40" ]];then continue; else echo -e "\u00${k}${i}" ;fi ;done;done)"

geek="$(for k in 9 A B C D E F;do for i in $(seq 1 9) A B C D E F ;do if [[ \"${k}${i}\" == \"A2\" ]];then echo -e "\\u0372\n\\u0376" ; else echo -e "\\u03${k}${i}"; fi ;done;done)"

cyrl="$(for k in $(seq 0 9) A B C D E F; do for i in $(seq 0 9) A B C D E F; do for n in $(seq 82 89); do if [[ \"${k}${i}\" == \"${n}\" ]];then  j=skip ; fi; done ; if [[ \"${j}\" == \"skip\" ]];then continue ; else echo -e "\\u04${k}${i}"; fi; done; done)"


May be there is a better way to enumerate these chars.

So moved everything below to enter_matrix.sh and now one file :)

##GPL-2.0 License 
function matrix_char() {

kota="$(for ich in A B C D E F;do for yo in $(seq 0 9) A B C D E F ;do echo -e "\\u30${ich}${yo}";done;done)"

askee="$(for k in 4 5 ;do for i in {0..9} A ;do if [[ "${k}${i}" == "40" ]];then continue; else echo -e "\u00${k}${i}" ;fi ;done;done)"

geek="$(for k in 9 A B C D E F;do for i in $(seq 1 9) A B C D E F ;do if [[ \"${k}${i}\" == \"A2\" ]];then echo -e "\\u0372\n\\u0376" ; else echo -e "\\u03${k}${i}"; fi ;done;done)"

cyrl="$(for k in $(seq 0 9) A B C D E F; do for i in $(seq 0 9) A B C D E F; do for n in $(seq 82 89); do if [[ \"${k}${i}\" == \"${n}\" ]];then  j=skip ; fi; done ; if [[ \"${j}\" == \"skip\" ]];then continue ; else echo -e "\\u04${k}${i}"; fi; done; done)"



for i in $(echo -e "${cyrl}")
        # echo a random character with index from 0 to 
        do echo "$RANDOM .$i "
done |
        {
                # sort, -r: reverse; n: numeric sorting instead to alphabetic
                sort -rn
        } | {
                # awk: a programming lagnuage designed to process text-based data
                # prints the second file from the pipepline
                awk '{print $2}' 
        } | {
                # sed   : stream edito: basic text transformation on an input stream
                # -e    : add the script to the commands to be executed (causes the next string
                #+ to be interpreted as an editing instruction
                # (''): the quotes protext the RE characters from reinterpretation as special
                #+ characters by the script
                # ';'   : semicolon is a special character in sed, which means 'end of command'
                # 'x'   : exhanges the contents of the hold and pattern spaces
                # 'd'   : delete pattern space. start next cycle.
                # '{'   : culry brackets allow to group several commands so that they are executed
                #+ for the same address range.: grymoire.com/Uni/Sed.html#uh-35
                # '!'   : DO NOT contain
                #'h H': copy/append pattern space to hold space
                # '$'   : match the last line
                # 'd'   : delete pattern space. start next cycle.
                # 'b'   : branch to label; if label is ommited, branch to end of script
                # 'p'   : print the current patter space
                sed -e '1{$p;x;d;}' -e '/^NEW/!{H;$!d;x;s/\n//g;b;}' -e 'x;s/\n//g;${p;x;}' 
        } | {
                        # substitue '.' with ' ' found in each input line from pipeline
                        sed 's/\./ /g' 
        }

}

Also changed ./lib/matrix_char.sh to matrix_char the function.

PaS3 avatar Aug 31 '20 19:08 PaS3