morrow@murdu.oz (Christopher Morrow) (05/16/89)
Recently I saw a request for information on how people download references into bibliography databases. Not being a programmer I found AWK to be the best method to format references captured by downloading or from CD-ROM. For other non-programmers I include an AWK programme that will convert DIALOG format 4 output that has been captured by logging a session (ie with Kermit) or files from a down load from a CD-ROM version. On the CD-ROM you need to redirect the print output to a file. Some programmes have this facility built in but DOS can do it. In ONDISC you do SET PRINT a:file The tag format is got by PR 1/4/1-79 | | | |- the number of the references to be captured | | |____ All important format number | |___________ Search number |____________________Dialog command to print. Then AWK the file %awk -f changefile datafile > outputfile The input file should look like TI- The title of the article and end with a full stop and vertical bar both which will be removed.| AU- Morrow CJ; Others IN; Final one THE| etc Once in REFER format it can be directly imported into EndNote or changed to BIBTEX format (ref2bib). Or you could write your own AWK programme. (make your programme LOOK GOOD by putting it through cb- C beautifier!!@!). If you do not have a UNIX box you can buy AWK from MKS for DOS. I did and it is great. If you want to put the output file from DOS to MACos you need to strip the line feeds (USE MacSink) If you have any suggestions please mail me. morrow@murdu.oz.au What follows is the AWK change file. --------------------------------------------------------------------- #Awk program to convert dialog format 4 References into Refer format #Copyright 1989, Chris Morrow. Have fun with it. /^TI-/,/\|/ { x = index($NF,".|") if(x!= 0){ $NF= substr($NF,1,x-1) } if($1 == "TI-"){ $1= "%T"; printf "\n%s\n", $0 ; } else{ printf "%s\n", $0 ; } } /^AU-/,/\|/ { $1 = ""; n = split($0,AU,";") for(i = 1;i<=n; i++){ if(i==n){ x= length(AU[n]); AU[n]= substr(AU[n],1,x-1) ; } m = split(AU[i],AUN); k= length(AUN[m]); printf "%s ", "%A " ; if(m>1){ for(l=1;l<=k;l++){ printf "%s. ",substr(AUN[m],l,1) ; } } else{ printf "%s ", AUN[m] ; } for(j = 1;j<m;j++){ printf "%s ", AUN[j] ; } printf "\n" ; } } /^JN-/,/\|/ { $1 = "%J" ; x = length($NF); $NF= substr($NF,1,x-1) ; print $0 ; } /^VO-/,/\|/ { y = length($NF) - 1 ; PP = substr($NF,2,y-1); printf "%s %s\n%s %s\n", "%V ", $2 , "%P ", PP ; } /^PY-/,/\|/ { x = length($NF); $NF= substr($NF,1,x-1) ; printf "%s %s\n" , "%D " , $NF ; } /^AB-/,/\|/ { if($1 == "AB-"){ $1 = "%X " }; print ; }