diff options
1 files changed, 32 insertions, 29 deletions
| -rwxr-xr-x | csg | 61 |
@@ -156,40 +156,43 @@ do mv "$file" "${file%md}html" done -overwriteLine "[Stage 1] Combining awk scripts" +if [ -n "$AWKSCRIPTS" ] +then + overwriteLine "[Stage 1] Combining awk scripts" -scr_path=() -scr_recip=() -while read -r reg; read -r scripts -do - cat $scripts > "$CSG_TMP_DIR/csg-${#scr_path[@]}.awk" - scr_path+=("$CSG_TMP_DIR/csg-${#scr_path[@]}.awk") - scr_recip+=("$(find $DESTINATION -type f -regex "$reg")") -done < <($CSG_AWK ' -{ - # Remove first field - $1=""; sub(FS, "") - # Associate current file with regex - if (awks[$0] == "") awks[$0] = FILENAME - else awks[$0] = awks[$0] " " FILENAME + scr_path=() + scr_recip=() + while read -r reg; read -r scripts + do + cat $scripts > "$CSG_TMP_DIR/csg-${#scr_path[@]}.awk" + scr_path+=("$CSG_TMP_DIR/csg-${#scr_path[@]}.awk") + scr_recip+=("$(find $DESTINATION -type f -regex "$reg")") + done < <($CSG_AWK ' + { + # Remove first field + $1=""; sub(FS, "") + # Associate current file with regex + if (awks[$0] == "") awks[$0] = FILENAME + else awks[$0] = awks[$0] " " FILENAME - nextfile -} -END { - for (reg in awks) { - print reg - print awks[reg] + nextfile } -} -' $(find $AWKSCRIPTS -type f -name "[A-Z]*.awk")) + END { + for (reg in awks) { + print reg + print awks[reg] + } + } + ' $(find $AWKSCRIPTS -type f -name "[A-Z]*.awk")) -overwriteLine "[Stage 1] Finding awk libraries" + overwriteLine "[Stage 1] Finding awk libraries" -scr_libs="" -while read -r file -do - scr_libs+=" -f $file " -done < <(find $AWKSCRIPTS -type f -name "#*.awk") + scr_libs="" + while read -r file + do + scr_libs+=" -f $file " + done < <(find $AWKSCRIPTS -type f -name "#*.awk") +fi endTimer "[Stage 1] Done" |
