Skip to content

Instantly share code, notes, and snippets.

@praton1729
Last active February 3, 2019 09:58
Show Gist options
  • Save praton1729/b53026b4f39e55412a2926b5d1df6542 to your computer and use it in GitHub Desktop.
Save praton1729/b53026b4f39e55412a2926b5d1df6542 to your computer and use it in GitHub Desktop.
A bash script that forms a dict file from the text files in the cwd.
#! /bin/bash
if [ -e words.dict ]
then
echo -e "Deleting the old dict file...\n"
rm ./words.dict
echo -e "Creating a new dict file...\n"
for f in $(ls *.md);do tail -n +2 $f | sed 's|[,.:-\;]||g' | sed 's|\s\s| |g' | tr ' ' '\n' | grep -v -e '^$' | uniq >> words.dict; done
echo -e "Done creating a new dict file...\n"
else
echo -e "Creating a new dict file...\n"
for f in $(ls *.md);do tail -n +2 $f | sed 's|[,.:-\;]||g' | sed 's|\s\s| |g' | tr ' ' '\n' | grep -v -e '^$' | uniq >> words.dict; done
echo -e "Done creating a new dict file...\n"
fi
#cat Advance_I.md Basic_VII.md Basic_VI.md | sed 's|[,.:-\;]||g' | sed 's|\s\s| |g' | tr ' ' '\n' | grep -v -e '^$' >> words.dict
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment