Oh no, it’s 12:05 and I haven’t even started on Real Text Processing…
- Reading source code, testing, adapting software to their own needs
- 4 programmers
Rating system – they’ve got this already
grep -ri 'mail' * -A 10 -B 10 | less
This displays enough context information around the data so that I can
grab it easily.
Shell scripting to the rescue!
# Zip their work up
for DIR in *; do ( cd $DIR; zip perl-day1.zip * ); done
# Realize that I have to get rid of the archives temporarily because
# I might want to insert all the files into a buffer, so back it up first
tar zcvf archive.tar.gz $(find -name \*.zip)
# Remove all the zip files
find -name \*.zip -exec rm {} \;
Data is of the form
number|Name|e-mail|Expectations
(defun sacha/perl-training/suck-data-in ()
"Insert BBDB records for all the Perl trainees."
(interactive)
(goto-char (point-min))
(while (re-search-forward "^\\([[:digit:]]+\\)" nil t)
(let ((data (split-string (buffer-substring-no-properties (line-beginning-position) (line-end-position)) "|"))
record)
(bbdb-record-set-aka
(bbdb-create-internal (elt data 1) ; Name
"PLDT" ; Company
(elt data 2) ; E-mail
nil
nil
(concat "Perl training 2003.12.17 - 2003.12.19; " (elt data 3)))
(list (concat "pldt" (elt data 0)))))))
(defun sacha/perl-training/suck-data-in ()
"Insert BBDB records for all the Perl trainees."
(interactive)
(goto-char (point-min))
(while (re-search-forward "^\\([[:digit:]]+\\)" nil t)
(let ((data (split-string (buffer-substring-no-properties (line-beginning-position) (line-end-position)) "|"))
record)
(setq record
(bbdb-create-internal (elt data 1) ; Name
"PLDT" ; Company
(elt data 2) ; E-mail
nil
nil
(concat "Perl training 2003.12.17 - 2003.12.19; " (elt data 3))))
(bbdb-record-set-aka record (list (concat "pldt" (elt data 0))))
(bbdb-change-record record nil))))