Learn the AWK programming language in a fun and interactive way with help of Emacs Org mode and Org-drill.
- Open 2 Emacs sessions
- Open awk.org in one session
- Open note-book.org in the other
- Start org-drill in the awk.org session
- Write your answers in the note-book.org session
note-book.org contains org mode awk source blocks for each of the files in text-files
.
When questions refers to files, use that specific source block when writing the answer.
You can then use C-c C-c
to interactively execute the code and get instant feedback.
This is the needed Emacs config. All of the org-babel-do-load-languages
is not needed,
just awk
.
To make new questions I use Org capture templates. They are easy to access via C-c c
a
. But as the questions are just plain text they can easily be written by hand. Just
follow the pattern.
(setq org-confirm-babel-evaluate nil)
(org-babel-do-load-languages
'org-babel-load-languages
'((emacs-lisp . t)
(shell . t)
(scheme . t)
(python . t)
(awk . t)
(sed . t)
(ledger . t)
(clojure . t)))
(use-package org-drill
:pin melpa)
(setq org-capture-templates
'(("a" "awk drill question"
entry (file+headline "~/git/learn-awk/awk.org" "Drills")
"\n\n** %^{Question title} :awk:drill:\n\n %^{Question body} \n\n*** Answer \n\n #+BEGIN_SRC awk :results output code :in-file ./text-files/%^{text file}\n %^{awk program}\n #+END_SRC")))
If you are using org-drill in awk.org. Org-drill adds some data to each of the headlines. This is your personal data and should not be version controlled. Run this to remove the personal org-drill data.
mv awk.org{,.bak}&&cat *.bak|awk '$1~/^SCHEDULED/,$1~/^:END/{next};$1~/^:PROPERTIES/,$1~/^:END/{next};{print}'>awk.org&&rm -f *.bak