All pastes #280841 Raw Edit

Something

public shellscript v1 · immutable
#280841 ·published 2006-12-16 05:39 UTC
rendered paste body
#!/bin/bashmake_chapters() {   input=( "$@" )   chapters=()   index=1   chapters[$index]=${input[$((index-1))]}   for ((i=1;i<${#input[@]};i++))   do      tmp="${chapters[$index]##* }"      if (( ${input[$i]%.*} > "${tmp%.*}" ))      then         chapters[$index]="${chapters[$index]} ${input[$i]}"      else         ((index++))         chapters[$index]="${input[$i]}"      fi   done   printf "${chapters[1]}\n${chapters[2]}\n"}make_chapters "$@"#Example:#[%] ./script 30 33.993 76.123 0.6 43.234 87.234 130.345#30 33.993 76.123#0.6 43.234 87.234 130.345