Guest User

test line buffer

a guest
Jul 1st, 2016
82
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. 1 . run this
  2.      watch -n 1 "date >> /tmp/test" &
  3. 2.TEST THIS:
  4. 2.1. tail -3f /tmp/test
  5.      every 1 sec print output, OK
  6. 2.2. tail -3f /tmp/test | grep --line-buffered 20
  7.     every 1 sec print date, "20" match with "2016"
  8. 2.3. tail -3f /tmp/test | grep --line-buffered 20 | sed  -e 's/20/18/'
  9.     every 1 sec print date and replace 20 to 18, or 2016 to 1816
  10. 2.4. tail -3f /tmp/test | grep --line-buffered 20 | sed -u -e 's/20/18/' | xargs -I {} echo {}
  11.     every 1 sec print date, similar command in 2.3
RAW Paste Data