#line #cache #seen #repeat #seconds #file #weren-t

app uncached

Only print new lines, or those which weren't seen in a while

1 unstable release

0.1.0 Dec 2, 2023

#2 in #seen

AGPL-3.0-only

19KB
183 lines

uncached

Only print new lines, or those which weren't seen in a while

Usage

Without arguments, uncached will erase repeated lines:

$ cat /tmp/inputs.txt
one
two
one
three
uncached$ cat /tmp/inputs.txt | uncached
one
two
three

A cache file can be provided to avoid repeat lines in a period of time:

$ cat /tmp/inputs.txt
one
two
three
$ # new values are printed
$ cat /tmp/inputs.txt | uncached -c /tmp/in.cache
one
two
three
$ # values are not printed
$ cat /tmp/inputs.txt | uncached -c /tmp/in.cache
$ sleep 5
$ # values older than 4 seconds are printed
$ cat /tmp/inputs.txt | uncached -c /tmp/in.cache
one
two
three
$ echo four >> /tmp/inputs.txt
$ # new values are printed
$ cat /tmp/inputs.txt | uncached -c /tmp/in.cache
four

Dependencies

~2.3–3MB
~57K SLoC