Summary Files Commits Branches @commit @diff @stats
diff options
context:
space:
mode:
1 files changed, 8 insertions, 0 deletions
-rwxr-xr-xYear 2/Computer Graphics Fundamentals/ExerciseJSExtractor.sh8
diff --git a/Year 2/Computer Graphics Fundamentals/ExerciseJSExtractor.sh b/Year 2/Computer Graphics Fundamentals/ExerciseJSExtractor.sh
new file mode 100755
index 0000000..46beab1
--- /dev/null
+++ b/Year 2/Computer Graphics Fundamentals/ExerciseJSExtractor.sh
@@ -0,0 +1,8 @@
+#!/bin/bash
+
+createOKGProblemFile() {
+ awk 'BEGIN { injs = 0 } /<\/script>/ { injs = 0 } { if (injs == 1) { gsub(/^\t\t\t/, ""); print } } /<script>/ { injs = 1 }' "$1" > $(echo "$1" | awk '{ print substr($0, 88, 2) ".js" }')
+}
+
+export -f createOKGProblemFile
+find "/mnt/Norilsk/Uni/2 курс/Зимен семестър/Ж277 - ОКГ/Упражнения/Problems S06/" -type f -wholename "*/Problem*/Problem*.html" -exec bash -c 'createOKGProblemFile "{}"' \;