Hacker News new | ask | show | jobs
by bofh23 1722 days ago
Avoiding “useless cat” on the command line is premature optimization. Sure, don’t do it in a script that is invoked a lot but it shouldn’t be a concern when prototyping a filter pipeline.

  $ cat foo | head -4
  b
  a
  c
  b
  
  $ cat foo | head -4 | sort
  a
  b
  b
  c
  
  $ cat foo | head -4 | sort | uniq -c
  1 a
  2 b
  1 c
  
  $ cat foo | head -4 | sort | uniq -c | sort -k1nr | head -1
  2 b