ehead=${bevents[0]}
let "ehead -= 1"
- bfoot=$(wc -l < $file)
+ bfoot=$(wc -l "$file")
let "bfoot -= ${eevents[-1]}"
for (( i=0; i < ${#bevents[@]}; i++)); do
- head -n $ehead "$file" > "$file"-$i.ics
- sed -n ${bevents[$i]},${eevents[$i]}p "$file" >> "$file"-$i.ics
- tail -n $bfoot "$file" >> "$file"-$i.ics
+ head -n $ehead "$file" > "$file-$i.ics";
+ sed -n ${bevents[$i]},${eevents[$i]}p "$file" >> "$file-$i.ics";
+ tail -n $bfoot "$file" >> "$file-$i.ics";
done
done