#!/bin/bash # AWK="/usr/bin/awk" # declare -i j=0 k=0 l=0 function preample() { cat <<-EOF #LyX 1.2 created this file. For more info see http://www.lyx.org/ \lyxformat 220 \textclass article \language english \inputencoding auto \fontscheme default \graphics default \paperfontsize default \papersize Default \paperpackage a4 \use_geometry 0 \use_amsmath 0 \use_natbib 0 \use_numerical_citations 0 \paperorientation portrait \secnumdepth 3 \tocdepth 3 \paragraph_separation indent \defskip medskip \quotes_language english \quotes_times 2 \papercolumns 1 \papersides 1 \paperpagestyle default EOF } function label() { n=$1 echo "" echo "\layout Standard" echo "" echo "" echo "\begin_inset LatexCommand \label{cit:$n}" echo "" echo "\end_inset" } preample # Output LyX commands for Chapter "All references" cat <<-EOF \layout Section All references EOF # `$AWK -f awkscr_cit $1 > references.tmp` # `$AWK 'BEGIN {FS=" - "} /ID/ {printf("\n%s\n\n%s%s%s\n\n%s\n","\\\\layout Standard","\\\\begin_inset LatexCommand \\\\label{cit:",$2,"}","\\\\end_inset")}' $1 > references.tmp` # Output all references. $AWK 'BEGIN {FS=" "} /\\begin_inset LatexCommand \\label{/ {gsub("label","ref"); printf("\n%s\n\n%s%s\n\n%s\n","\\layout Standard","\\begin_inset LatexCommand ",$3,"\\end_inset")}' $1 > all-references.tmp cat all-references.tmp rm all-references.tmp # Output LyX commands for Chapter "All references" cat <<-EOF \layout Section All figure references EOF # Output only the figures. $AWK 'BEGIN {FS=" "} /\\begin_inset LatexCommand \\label{fig-/ {gsub("label","ref"); printf("\n%s\n\n%s%s\n\n%s\n","\\layout Standard","\\begin_inset LatexCommand ",$3,"\\end_inset")}' $1 > fig-references.tmp cat fig-references.tmp rm fig-references.tmp # Output LyX commands for Chapter "All references" cat <<-EOF \layout Section All table references EOF # Output only the tables. $AWK 'BEGIN {FS=" "} /\\begin_inset LatexCommand \\label{tab-/ {gsub("label","ref"); printf("\n%s\n\n%s%s\n\n%s\n","\\layout Standard","\\begin_inset LatexCommand ",$3,"\\end_inset")}' $1 > tab-references.tmp cat tab-references.tmp rm tab-references.tmp # let l=0 # until test $l -eq 85 ; do # let l=l+1 # label $l # done echo "\the_end"