diff options
author | psachin | 2013-07-31 12:20:13 +0530 |
---|---|---|
committer | psachin | 2013-07-31 12:20:13 +0530 |
commit | 9643c51f416d32851fce6b36a9a269b02d57f21e (patch) | |
tree | 8f3254aa261fdd1a0c5e213d3876dba93cdbcf7a | |
parent | b843fb855e7d15c2af7d5553ab0a3187680d6f56 (diff) | |
download | tbc-auto-checker-9643c51f416d32851fce6b36a9a269b02d57f21e.tar.gz tbc-auto-checker-9643c51f416d32851fce6b36a9a269b02d57f21e.tar.bz2 tbc-auto-checker-9643c51f416d32851fce6b36a9a269b02d57f21e.zip |
Subject: sorting of file-names w.r.t chapter number
Description:
- sorting
- added usage in ReadMe.md
-rw-r--r-- | ReadMe.md | 55 | ||||
-rwxr-xr-x | auto.sh | 20 |
2 files changed, 73 insertions, 2 deletions
@@ -1,4 +1,57 @@ # tbc-auto-checker ### Auto checker script for Scilab Textbook Companion. -### Please visit [http://scilab.in/Textbook_Companion_Project](http://scilab.in/Textbook_Companion_Project) for more info. +### Usage + +* Clone this repository + +```bash +git clone https://github.com/Scilab-India/tbc-auto-checker.git +``` + +* Change path to this directory + +```bash +cd tbc-auto-checker +``` + +* Place ZIP file(s) of book(s) in this directory and run the script + +```bash +bash auto.sh +``` + +### Output + +* The output log files and error log files will be generated +separately. + +#### text output + +* Text output will be stored in `output_<book-name>.log` file. + +#### graph output + +* You have to set a variable `SCI_GRAPH_PATH` to a path where you want +all the graphs to be stored. + +* Graphs with text output will be stored in + `output_graph_<book-name>.log` file + +#### errors + +* **for text based errors**: `error_<book-name>.log` + +* **for graph based errors**: `error_graph_<book-name>.log` + +#### Warning + +* All output are first stored in a variable and then written to + respective files. You may run out of memory sometimes. + +#### Site + +Please visit +[http://scilab.in/Textbook_Companion_Project](http://scilab.in/Textbook_Companion_Project) +for more info. + @@ -52,7 +52,25 @@ function scan_sce_for_errors() { # make a list of all .sce file(with complete path). Exclude # scanning 'DEPENDENCIES' DIR - SCE_FILE_LIST=$(find ${ZIPFILE} -type f -iname "*.sce" ! -path "*/DEPENDENCIES*") + + # That awk command says the field separator FS is set to /; this + # affects the way it reads fields. The output field separator OFS + # is set to "."; this affects the way it prints records. This is + # intentionally done so that 'cut' will take "." as a field + # Seperator during final sort operation. The next statement says + # print the last column (NF is the number of fields in the record, + # so it also happens to be the index of the last field) as well as + # the whole record ($0 is the whole record); it will print them + # with the OFS between them. Then the list is sorted, treating _ + # as the field separator - since we have the filename first in the + # record, it will sort by that. Then the cut prints only fields 3 + # through the end, again treating "." as the field separator. + + SCE_FILE_LIST=$(find ${ZIPFILE} -type f -iname "*.sce" ! \ + -path "*/DEPENDENCIES*" | \ + awk -vFS=/ -vOFS="." '{print $NF,$0}' | \ + sort -n -t _ -k1 -k2 | cut -d"." -f3-) + SCE_FILE_COUNT=$(echo "${SCE_FILE_LIST}" | wc -l) echo -e "Total number of .sce files(without counting DEPENDENCIES directory): ${SCE_FILE_COUNT}\n" >> ./output_${ZIPFILE}.log |