Last active
August 16, 2021 10:41
-
-
Save tatumroaquin/2ecc1fe2d5354cb9743cdb0c2b1da1bc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
#author :ormux | |
#date :2019/08/31 (August 31) | |
#description :generates a needed bookcode for my cryptographic puzzles. | |
#title :getbookcode.sh | |
#usage :bash getbookcode.sh | |
read -p "enter word/sentence: " word | |
line_num=1 | |
word_idx=1 | |
while read line; do | |
for((i = word_idx; i <= ${#word}; i++)); do | |
for j in $(seq 1 ${#line}); do | |
if [[ "${word:i-1:1}" == "${line:j-1:1}" ]]; then | |
echo $line_num:$j | |
((word_idx++)) | |
break 2 | |
fi | |
done | |
done | |
((line_num++)) | |
done < text.txt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment