35 lines
		
	
	
		
			907 B
		
	
	
	
		
			Awk
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			35 lines
		
	
	
		
			907 B
		
	
	
	
		
			Awk
		
	
	
		
			Executable File
		
	
	
	
	
#!/usr/bin/awk -f
 | 
						|
# rem2ics by Anthony J. Chivetta <achivetta@gmail.com>
 | 
						|
# version 0.1 - 2006-06-09
 | 
						|
# Converts output of remind -s to iCalendar
 | 
						|
# usage: remind -s | rem2ics
 | 
						|
#
 | 
						|
# THE FOLLOWING CODE IS RELEASED INTO THE PUBLIC DOMAIN
 | 
						|
#
 | 
						|
# This program is distributed in the hope that it will be useful,
 | 
						|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
						|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE
 | 
						|
BEGIN {
 | 
						|
print "BEGIN:VCALENDAR"
 | 
						|
print "VERSION:2.0"
 | 
						|
}
 | 
						|
{
 | 
						|
gsub("/","",$1)
 | 
						|
print "BEGIN:VEVENT"
 | 
						|
if ($5 != "*"){
 | 
						|
printf("DTSTART:%dT%02d%02d00\n",$1,$5/60,$5%60)
 | 
						|
printf("DTEND:%dT%02d%02d00\n",$1,$5/60+$4/60,$5%60+$4%60)
 | 
						|
split(substr($0,match($0,$7)),sumloc,"|")
 | 
						|
print "SUMMARY:" sumloc[1]
 | 
						|
} else {
 | 
						|
printf("DTSTART:%d\n",$1)
 | 
						|
split(substr($0,match($0,$6)),sumloc,"\|")
 | 
						|
print "SUMMARY:" sumloc[1]
 | 
						|
}
 | 
						|
if (sumloc[2]) {
 | 
						|
print "LOCATION:" sumloc[2]
 | 
						|
}
 | 
						|
print "END:VEVENT"
 | 
						|
}
 | 
						|
END {print "END:VCALENDAR"}
 |