Fortune is a unix utility
- Download the plain-text of your favorite book :
- Name the file what you want the fortune command to invoke
- eg alice
- Change line endings from DOS to unix :
:set ff=unix
in vim
- Delete the preamble and license at the end
- (while respecting it)
- Delete all the chapter titles
:g/CHAPTER*/d
in vim
- Fix newline discrepancy
:%s/\n\n\n/\r\r/g
with increasing number of\n
s until nothing matches (let me know if there's a better way)
- Add % signs to separate paragraphs
:%s/\n\n/\r\r%\r\r/g
- This could also be used to add author names/ book titles to each quote
- Randomize access to the file using strfile
strfile alice
this should give you alice.dat
- Copy the fortunes to the right spot!
cp alice* /usr/share/games/fortune
on FreeBSD
- Enjoy!
$fortune alice