clead awk script a bit
This commit is contained in:
parent
5586619abf
commit
54b10ad726
@ -1,16 +1,16 @@
|
|||||||
# 11:00|13:00|1748422800|1748430000|fpath|desc...
|
# 11:00|13:00|1748422800|1748430000|fpath|desc...
|
||||||
# 00:00|00:00|1748296800|1748383200|fpath|desc...
|
# 00:00|00:00|1748296800|1748383200|fpath|desc...
|
||||||
function allday() {
|
function allday(desc) {
|
||||||
return ITALIC FAINT " (allday) " OFF $6
|
return ITALIC FAINT " (allday) " OFF desc
|
||||||
}
|
}
|
||||||
function endstoday() {
|
function endstoday(stop, desc) {
|
||||||
return CYAN " -- " $2 OFF ": " $6
|
return CYAN " -- " stop OFF ": " desc
|
||||||
}
|
}
|
||||||
function slice() {
|
function slice(start, stop, desc) {
|
||||||
if ($2 == "00:00")
|
if (stop == "00:00")
|
||||||
return CYAN $1 " -- " OFF ": " $6
|
return CYAN start " -- " OFF ": " desc
|
||||||
else
|
else
|
||||||
return CYAN $1 OFF " -- " CYAN $2 OFF ": " $6
|
return CYAN start OFF " -- " CYAN stop OFF ": " desc
|
||||||
}
|
}
|
||||||
function hrline(hour) {
|
function hrline(hour) {
|
||||||
print hour, "", "", "", FAINT hour ":00 ----------------------" OFF
|
print hour, "", "", "", FAINT hour ":00 ----------------------" OFF
|
||||||
@ -25,23 +25,23 @@ function hrlines(start, stop, h, starth, stoph, tmp, i) {
|
|||||||
return stoph + tmp
|
return stoph + tmp
|
||||||
}
|
}
|
||||||
BEGIN {
|
BEGIN {
|
||||||
FS = "|";
|
FS = "|"
|
||||||
daystart = 8
|
daystart = 8
|
||||||
dayend = 18
|
dayend = 18
|
||||||
GREEN = "\033[1;32m";
|
GREEN = "\033[1;32m"
|
||||||
RED = "\033[1;31m";
|
RED = "\033[1;31m"
|
||||||
WHITE = "\033[1;97m";
|
WHITE = "\033[1;97m"
|
||||||
CYAN = "\033[1;36m";
|
CYAN = "\033[1;36m"
|
||||||
ITALIC = "\033[3m";
|
ITALIC = "\033[3m"
|
||||||
FAINT = "\033[2m";
|
FAINT = "\033[2m"
|
||||||
OFF = "\033[m";
|
OFF = "\033[m"
|
||||||
OFS = "|"
|
OFS = "|"
|
||||||
}
|
}
|
||||||
$1 == "00:00" && $2 == "00:00" { print $1, $3, $4, $5, allday(); next }
|
$1 == "00:00" && $2 == "00:00" { print $1, $3, $4, $5, allday($6); next }
|
||||||
$1 == "00:00" { print $1, $3, $4, $5, endstoday(); next }
|
$1 == "00:00" { print $1, $3, $4, $5, endstoday($2, $6); next }
|
||||||
$1 ~ /^[0-9]{2}:[0-9]{2}$/ {
|
$1 ~ /^[0-9]{2}:[0-9]{2}$/ {
|
||||||
daystart = hrlines($1, $2, daystart, starth, stoph, tmp, i)
|
daystart = hrlines($1, $2, daystart, starth, stoph, tmp, i)
|
||||||
print $1, $3, $4, $5, slice()
|
print $1, $3, $4, $5, slice($1, $2, $6)
|
||||||
}
|
}
|
||||||
END {
|
END {
|
||||||
hrlines(dayend":00", 0, daystart, starth, stoph, tmp, i)
|
hrlines(dayend":00", 0, daystart, starth, stoph, tmp, i)
|
||||||
|
Loading…
Reference in New Issue
Block a user