DEAR PEOPLE FROM THE FUTURE: Here's what we've figured out so far...

Welcome! This is a Q&A website for computer programmers and users alike, focused on helping fellow programmers and users. Read more

What are you stuck on? Ask a question and hopefully somebody will be able to help you out!
0 votes

Is it possible to cat only selected lines of a file? For example the first 10, last 15, or "from 20 to 30"?

by

1 Answer

+2 votes
 
Best answer

That's what the head and tail programs are for :)

First ten lines

head -n 10 FILE

Last ten lines

tail -n 10 FILE

From lines 3 to 5:

head -n 5 FILE | tail -n 3

by
selected by
Contributions licensed under CC0
...