** mentions of file names in file contents
:PROPERTIES:
:DATE: 2011-02-20
:END:
directory to search
#+name: graph-dir
: graph-dir
list all files in dir
#+name: graph-files
#+begin_src sh :results vector :var dir=graph-dir
find $dir -type f -exec basename {} \;
#+end_src
#+name: graph-files
| other |
| dan |
| eric |
| seb |
association of files with mentions
#+name: graph-associations
#+begin_src sh :var dir=graph-dir :var files=graph-files
for i in $files; do
for j in `grep -l -r $i $dir`;do
echo $i, `basename $j`
done
done
#+end_src
#+name: graph-associations
| other | eric |
| other | seb |
| dan | eric |
| eric | seb |
| seb | dan |
graphing with dot
#+name: to-dot
#+begin_src sh :var associations=graph-associations :results scalar
echo "$associations"|awk '{print $1, "->", $2}'
#+end_src
#+name: to-dot
: other -> eric
: other -> seb
: dan -> eric
: eric -> seb
: seb -> dan
#+begin_src dot :var data=to-dot :file files.png
digraph G{
$data
}
#+end_src
#+name:
[[file:files.png]]