Created
September 17, 2019 22:13
-
-
Save espinz/ca565801aa40b673db400343449927f3 to your computer and use it in GitHub Desktop.
Revisions
-
espinz created this gist
Sep 17, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,12 @@ COUNT=$(ls | grep -E "Chapter\ [0-9]" | cut -d ' ' -f 3-10 | wc -l) for x in `seq 0 $COUNT`; do if [ "$x" -eq "0" ]; then newDIRS=$(ls | grep -E "Chapter\ [0-9]" | cut -d ' ' -f 3-10 | head -n 1) mkdir "$x. ${newDIRS}" else DIRS=$(ls | grep -E "Chapter\ [0-9]*" | sort -k2 -n | cut -d ' ' -f 3-10 | tail -n 15 | sed -n ${x}p) newDIRS=$(ls | grep -E "Chapter\ [0-9]" | cut -d ' ' -f 3-10 | sed -n ${x}p) mkdir "$x. ${DIRS}" fi done