trap "/bin/rm -f \"$tempdir\"/*.ics; rmdir \"$tempdir\"" QUIT INT EXIT
for file in "$@"; do
- bevents=($(grep -n BEGIN:VEVENT "$file" | cut -d: -f1))
- eevents=($(grep -n END:VEVENT "$file" | cut -d: -f1))
+ bevents=($(grep -hn BEGIN:VEVENT "$file" | awk -F: '{print $1}'))
+ eevents=($(grep -hn END:VEVENT "$file" | awk -F: '{print $1}'))
ehead=${bevents[0]}
let "ehead -= 1"