#!/bin/bash


if [[ -z $1 ]]; then
    echo "exit: need list of papers file" 
    exit -1
fi
infile=$1 


sed 's/ ([12][0-9][0-9][0-9]).*$//;s/&//' $infile  |     \
   awk -F "[.]," '{for (i=1;i<=NF;i++){print $i}}' |     \
   sed 's/^  *//;s/\..*//'                         |     \
   sort -t ","                                     |     \
   tee authors.txt                                 |     \
   uniq -c                                         |     \
   sort -nr                      
