Hello scripting geniusii! I come to kneel before the alter of your wisdom!
I am looking to take a keyword and replace characters within that keyword and add them to a string variable. I would like this to only go through however many characters the word has, which may vary in size.
Example word - dominos:
$ echo "dominos" | sed 's/./_/1; s/./_/2'
__minos
$ echo "dominos" | sed 's/./_/1; s/./_/3'
_o_inos
$ echo "dominos" | sed 's/./_/1; s/./_/4'
_om_nos
$ echo "dominos" | sed 's/./_/1; s/./_/5'
_omi_os
$ echo "dominos" | sed 's/./_/1; s/./_/6'
_omin_s
$ echo "dominos" | sed 's/./_/1; s/./_/7'
_omino_
$ echo "dominos" | sed 's/./_/2; s/./_/3'
d__inos
$ echo "dominos" | sed 's/./_/2; s/./_/4'
d_m_nos
$ echo "dominos" | sed 's/./_/2; s/./_/5'
d_mi_os
$ echo "dominos" | sed 's/./_/2; s/./_/6'
d_min_s
$ echo "dominos" | sed 's/./_/2; s/./_/7'
d_mino_
...
In the end state, I would like it to look like this:
KEYWORD="__minos _o_inos _om_nos _omi_os _omin_s _omino_ d__inos d_m_nos d_mi_os d_min_s ... "
I am doing this today manually, creating my "KEYWORD" variable, but I'm trying to tidy this all up and make my script pull the current working directory and use that as the keyword variable base, so that my script can be standardized over several different keywords I'm working with.
Hope this makes some sense, and Thanks so much in advance for your thoughts!
Dave aka Ghan