How does one display certain lines of a file in Linux (several lines in the middle)

Source: Internet
Author: User

[1] 3,000th rows are displayed starting from 1000 rows. Display 3000 ~ 3999 rows

Cat filename | tail-N + 3000 | head-N 1000

 

[2] display rows 1000 to 3000

Cat filename | head-N 3000 | tail-N plus 1000

 

* Pay attention to the order of the two methods

 

Decomposition:

Tail-N 1000: displays the last 1000 rows

Tail-N + 1000: The value ranges from 1000 rows to 1000 rows.

Head-N 1000: displays the first 1000 rows

 

[3] use the SED command

 

Sed-n'5, 10p' filename so that you can view only rows 5th to 10th of the file.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.