mirror of
https://github.com/G2-Games/anagram-finder.git
synced 2025-04-19 03:12:52 -05:00
Add files
This commit is contained in:
parent
986e0f7030
commit
cbd8cbb1c0
3 changed files with 933112 additions and 0 deletions
12
anagram.sh
Normal file
12
anagram.sh
Normal file
|
@ -0,0 +1,12 @@
|
|||
#!/bin/bash
|
||||
word=$1
|
||||
wordsorted=$(echo $word | grep -o . | sort | tr -d "\n")
|
||||
lines=$(grep -xin -- "$wordsorted" sortedwords.txt | sed -e 's/:.*//g')
|
||||
if [[ $lines = "" ]]; then
|
||||
echo "No matches."
|
||||
exit 0
|
||||
fi
|
||||
readarray -t lines <<<"$lines"
|
||||
for i in "${lines[@]}"; do
|
||||
sed "${i}q;d" words.txt | tr '[:upper:]' '[:lower:]'
|
||||
done
|
466550
sortedwords.txt
Normal file
466550
sortedwords.txt
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue