tradelog/list-tick.awk
2021-04-07 00:04:06 +02:00

35 lines
574 B
Awk

BEGIN {
RS="\n"
FS=";"
split(ARG_TICKER, _tmp_tickers, ";")
for (i in _tmp_tickers) {
tickers[_tmp_tickers[i]] = ""
hasTickers = 1
}
gsub(/[-: ]/, "", ARG_DATE_AFTER);
gsub(/[-: ]/, "", ARG_DATE_BEFORE);
}
(hasTickers == 1) && ($2 in tickers == 0) { next }
{
fieldDate=$1
gsub(/[-: ]/, "", fieldDate);
if (ARG_DATE_AFTER != "" && ARG_DATE_AFTER > fieldDate) { next }
if (ARG_DATE_BEFORE != "" && ARG_DATE_BEFORE < fieldDate) { next }
}
{
if ($2 in unique_tickers == 0) {
unique_tickers[$2] = ""
}
}
END {
for (i in unique_tickers) {
print i
}
}