How can I merge from command line multiple .ics calendar files in to one ics calendar file?


I used this script:

echo "BEGIN:VCALENDAR" >> merge;
for file in *.ics; do 
cat "$file" | sed -e '$d' $1 | sed -e '1,/VEVENT/{/VEVENT/p;d}' $2  >> merge; 
mv merge merge.ics
echo "END:VCALENDAR" >> merge.ics;
  • This leads to the sed error sed: 1: "1,/VEVENT/{/VEVENT/p;d} ": extra characters at the end of d command
    – Mundi
    Sep 1 at 16:01
  • Are you on Linux? As I understood sed has problems on BSD and Mac systems. If so - try "sed -i''. Sep 3 at 22:59
  • Correct, I am on Mac. Now the error is sed: -I or -i cannot be used with stdin.
    – Mundi
    Sep 5 at 21:26
  • Solved with a lengthy php script.
    – Mundi
    Sep 7 at 5:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.