Can I display lines from the middle?

094

Yes, you can display lines from the middle of a file using a combination of the sed or awk commands. Here are examples for both:

Using sed

To display lines from, for example, line 10 to line 15:

sed -n '10,15p' filename.txt

Using awk

You can also use awk to achieve the same result:

awk 'NR>=10 && NR<=15' filename.txt

Replace filename.txt with the name of your file and adjust the line numbers as needed.

0 Comments

no data
Be the first to share your comment!