Happy to hear you've tried it and gotten this far. Sorry to hear of the difficulties.
Not sure I'm in a good position to solve this for you-can't simulate it at present, but some ideas/advice:
Explanation:
Line 102:
"sed" calls up the stream editor, to edit the xxx.ics file data on the fly while assembling into the xxx.full.ics file. The -e argument simply tells it that there are additional line edits to append to this command (lines 103 thru 106). Note that the backslash "\" at the end of each line is a connector to the next line.
What these lines do, individually, is:
Line 102: Detect in the xxx.ics file any lines that begin (i.e 's/) with "SUMMARY:" (with a .* wildcard to identify any subsequent text), and replace them with "SUMMARY:Booked".
Line 103: Similarly for any line beginning with "URI", replacing with "URI:"
Line 104: Similarly for any line beginning with "DESCRIPTION:"
Line 105: Similarly for any line beginning with "LOCATION:"
Line 106: Different. Sometimes the SUMMARY line (and potentially others) may overflow into a second, third, etc line in the initial xxx.ics file. This line deletes these extra line occurrences (crude, but probably sufficient).
(SUMMARY, DESCRIPTION, URI, and LOCATION fields in the file seem to correlate with the event Title, URL, Notes, and Location fields.)
Suggestions:
Its not obvious what is happening for you and I can't really simulate or solve it but you can try modifying things somewhat and see if you can get it working. I would suggest that you:
-find/delete any copies of the xxx.full.ics file that may be accidentally left lying around
-begin with a fresh copy of the script to avoid any possible typos resulting from your earlier work
-try removing 1 line at a time. start with 103 or 104 or 105 to see if there is one particular line that is causing the syntax error. Remove one of those lines and test, then a second, then all three. At this point, I expect you will be getting those fields in your calendar, but not yet the Summary event field.
-if you then try to remove line 106 while leaving one/some previous lines in place, recognize that you will have the last existing line with a "\" connector at its end, without any following line for it to connect to. This would probably generate a syntax error. So if you remove line 106 while leaving line 102, then remove the backslash from 102 as well.
So finally, from Creighton, the suggestion:
In addition to taking out all lines 102-106 now, also remove the backslash and pipe (vertical bar) at the end of line 101.
Basically, make it look like this (ignore line #'s here):
- function get_events_from_file {
- EVENT_FILE=${1}
- # This script was written to take a business calendar and publish it
- # online to show available vs. booked times.
- #
- # For reasons of privacy, many event details are suppressed, to
- # let all details display, delete everything from "sed" to the end
- # of the command.
- cat ${EVENT_FILE} | \
- awk 'BEGIN { is_event=0 }
- /^BEGIN:VEVENT/ { is_event=1 }
- /^END:VEVENT/ { print $0; is_event=0 }
- { if ( 1 == is_event ) { print $0 } }'
- }
I'm betting Creighton's suggestion solves it. If so, apologies for my incomplete instructions in the original post. Please post your success/difficulties so that we can all know if this solves it.
Good Luck