I'm launching a course about Next.js + React.jsLearn more

Truncate file


2017-10-01 · 1 min read

Use sed to truncate a file in-place sed

sed -i '11001,$ d' filename
  • -i means in place.
  • d means delete.
  • 11001,$ means the lines from 11001 to the end.

As a result, this command will create a file with 11,000 max.

My Tech Newsletter

Get emails from me about programming & web development. I usually send it once a month