2021-11-28

how to use values with sed in shell scripting?

i am trying te write a shell script in alphametic ,

i have 5 parameters like this

$alphametic 5790813 BEAR RARE ERE RHYME

to get

ABEHMRY -> 5790813

i tried this :

  #!/bin/bash
    echo "$2 $3 $4 $5" | sed  's/ //g ' | sed 's/./&\n/g' | sort -n |  sed '/^$/d' | uniq -i > testing
    paste -sd ''  testing  > testing2 
    sed "s|^\(.*\)$|\1 -> ${1}|" testing2 

but i get error (with the last command sed), i dont know where is the problem .



from Recent Questions - Stack Overflow https://ift.tt/3xubxNj
https://ift.tt/eA8V8J

No comments:

Post a Comment