Print only new values to stdout, or those that weren't seen in a while.
Project description
newold
Print only new values to stdout, or those that weren't seen in a while.
Usage
In order to allow old values, newold requires a database to store the values last seen time. You can specify the database file with --db
parameter or NEWOLD_DB
environment variable.
Here is an usage example:
$ cat /tmp/inputs.txt
one
two
three
$ # new values are printed
$ cat /tmp/inputs.txt | newold --db /tmp/in.db
one
two
three
$ # values are not printed
$ cat /tmp/inputs.txt | newold --db /tmp/in.db
$ sleep 5
$ # values older than 4 seconds are printed
$ cat /tmp/inputs.txt | newold --db /tmp/in.db --seconds 4
one
two
three
$ echo four >> /tmp/inputs.txt
$ # new values are printed
$ export NEWOLD_DB=/tmp/in.db
$ cat /tmp/inputs.txt | newold
four
Without a database only new values are printed to stdout. This behaves like anuniq
command that doesn't require the lines to be ordered:
$ cat /tmp/inputs.txt
one
two
one
three
$ cat /tmp/inputs.txt | newold
one
two
three
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
newold-0.0.2.tar.gz
(15.9 kB
view hashes)
Built Distribution
newold-0.0.2-py3-none-any.whl
(16.2 kB
view hashes)