Summary Files Commits Branches @commit @diff @stats
path: root / Year 2 / Computer Graphics Fundamentals / ExerciseJSExtractor.sh
blob: 46beab10df6127a51657e205ad0c2265fe4e9ffd (plain) (blame)
1
2
3
4
5
6
7
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 "{}"' \;