I had a need to run uniq on an open stream. It doesn't seem to print the most recent line. $ lua -e 'print("a");print("b");print("c"); repeat until false' |uniq a b ^ should print the c as well, no?