#!/bin/sh
#
# rewrite - pipe a command into this, each output line will rewrite previous one

# shellcheck disable=SC2312

sed --unbuffered '2,$s|^|\\e[1A\\e[K|' | cut -c-"$(tput cols)" \
  | xargs -d '\n' -L 1 echo -e
