Hacker News new | ask | show | jobs
by mths 1248 days ago
For that, to start with, you'd need to be able to create a feedback loop of awk's output back to itself as input. For it not to interfere with rendering, it needs to be on a separate file descriptor from stdout.

I found this snippet on stackexchange showing how exactly that is possible on Linux.

> echo hello | gawk '!length{exit(0)} {print; print substr($0,2) >"/dev/fd/3"; fflush()}' 3>/dev/fd/0

This "renders" on stdout then feeds itself more input on /dev/fd/3.

1 comments

Wow