Code:
#!/bin/sh
while sleep 5 ; do
    apcaccess | awk '/^LINEV/{print strftime("%F %F", systime()) " " $3 >> "/tmp/line_voltages.txt"}'
done