HN
Hacker News
Top
New
Best
Ask
Show
Jobs
Comment by jooize | Hacker News Reader
Parent
Full thread
jooize
·
How is input to a pipe reversed?
View on HN
School-Cotton
·
By saving all the input in memory (EDIT: or to a file, as another comment points out) until EOF, then writing the lines out in reverse order.
It's not really possible to do in a stateless/streaming way.
wolfgang42
·
It’s written to a seekable tempfile first:
https://github.com/coreutils/coreutils/blob/6a3d2883fed853ee...
Reply on news.ycombinator.com