Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'View upcoming events on multiple Unix calendars' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
View upcoming events on multiple Unix calendars
Authored by: tbdavis on May 15, '06 10:52:03AM

If you want to avoid the temporary file — and you use some bash like shell — you can use process substitution. The following example demonstrates this and also makes use of the above hint about including additional calendars


sort -M <( calendar -l 0 -f ~/.calendar/calendar.see_also ) \
        <( calendar -l 14 -f ~/.calendar/calendar )

Process substitution <(command) creates a named pipe and passes the name of that named pipe as the argument where the <(...) construct is.

Note: Including the files with #include directive is much faster than processing them individually (about four times faster on my Mac), and sorting them together. Of course passing ~/tmpcal.txt as an argument to sort is also faster than using cat and piping the result, but the speedup is not that much. And using process substitution is about the same speed as piping the results from piping cat.



[ Reply to This | # ]
View upcoming events on multiple Unix calendars
Authored by: tbdavis on May 15, '06 11:00:04AM

And using the sub-shell — about which previously I was ignorant — is the fastest of all.



[ Reply to This | # ]