Asked • 05/03/19

Bash tool to get nth line from a file?

Is there a "canonical" way of doing that? I've been using `head -n | tail -1` which does the trick, but I've been wondering if there's a Bash tool that specifically extracts a line (or a range of lines) from a file. By "canonical" I mean a program whose main function is doing that.

1 Expert Answer


Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.


Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.