#!/bin/bash #./Gen_ACR ABC_bc.dat # # input file: ABC_bc.dat is list of bibicode, citation (per line) for author "ABC" # # output files: # bc.dat ... list of bibcodes of author with citations>0 # ref_bc.dat ... list of bibcodes of papers referred to be the author # cite_bc.dat ... list of bibcodes of papers citing the author # ABC_coauthors.dat .. list of co-authors of the author if [[ -z $1 ]]; then echo "exit: need file listing bibcodes, no. of citations" exit -1 fi infile=$1 outf=${infile%_*} echo infile, $outfile Token=$(cat ADS_Token) #list of bibcodes for publications with non zero publications awk -F, '$2>0{print $1}' $infile > bc.dat #number of papers and number of citations npap=$(wc -l < bc.dat); npap=$((npap+0)) ncites= $(awk -F"," '{c+=$2}END{print "citations: " c}' $infile) echo "number of papers with cites>0: " $npap " number of cites: " $ncites cat cmd1 > cmd echo -n "$'bibcode" >> cmd awk '{printf "\\n%s", $1}' bc.dat >> cmd echo -n "'" >> cmd source cmd > Astruct #the output is stored in structure "Astruct" jq -r '.response.docs[] | .author[]' Astruct | sed 's/&/%26/g' > ${outf}_coauthors.dat #replace "&" by URL encoding jq -r '.response.docs[] | .citation[]' Astruct | sed 's/&/%26/g'> cite_bc.dat nc=$(wc -l < cite_bc.dat) echo "generated cite_bc.dat number of cites:" $nc jq -r '.response.docs[] | .reference[]' Astruct | sed 's/&/%26/g'> ref_bc.dat nr=$(wc -l < ref_bc.dat) echo "generated ref_bc.dat number of refs:" $nr