News for hackers. Stuff that matters.
Re:When your data doesn’t fit in memory: the basic techniques by herpderperator on Monday November 11, 2019 @05:36PM (#21509667)
I am confused. What's wrong with `wc -l < file | ... | ...`?

I know `< file wc -l | ... | ...` is identical because the redirection is done before the command is executed, but what does putting it in front help with?

Re:When your data doesn’t fit in memory: the basic techniques by squiggleblaz on Tuesday November 12, 2019 @05:23AM (#21513006)
Because I feel the other answers, though correct, are entirely missing out on clarity:

The first iteration looks like this:

<file head -n10 | grep foo | tr baz qux

The second iteration looks like this:

<file gzcat | head -n10 | grep foo | tr baz qux

It makes the change much easier, since the first thing written is the first thing that happens. In `gzcat < file`, the logical first step - reading and streaming file - is now the physical second step. Like a German sentence, whenever you want to prepend the file, you have to maintain an item in second position.

Re:When your data doesn’t fit in memory: the basic techniques by emj on Monday November 11, 2019 @05:52PM (#21509789)
You can easily change that first command with muscle memory. That's why I use cat $file| but I guess <$file would work too.
Re:When your data doesn’t fit in memory: the basic techniques by emmelaich on Monday November 11, 2019 @07:12PM (#21510283)
As per James Taylor's comment above, using cat means you can easily replace it with head e.g. for testing.

And not change anything else in the pipeline.