Skip to content

Comment on Cat without cat on the commandline (2020)parent

Comments

In most cases you could simply use a huge number of lines like

  head filename -n 1000000000
or use the "inverse mode". Head and tail can print all but the first/last n lines (I just have trouble to remember without man page the syntax and which does what). So those are more "cat equivalents":
  head -n-0 filename
  tail -n+0 filename
PS: for your wc example you could actually do just
  head -n $(wc -l filename)
because `wc` will print the number of lines and the filename. (does not work with spaces)
AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.