Linux is a cat, tail, head view of any number of rows of data

Source: Internet
Author: User

First, use cat, tail, head combination

1, view the last 1000 lines of data

Cat FileName | Tail-n 1000
2. View data from 1000 to 3000 rows

Cat FileName | Head-n 3000 | Tail-n +1000

1, cat filename Print all the contents of the file
2, tail-n 1000 print file Last 1000 rows of data
3, tail-n +1000 print file After the beginning of the 1000th line of content
4, Head-n 1000 print the first 1000 content

Ii. Use of sed command

Show 1000 to 300 rows of data

Sed-n ' 1000,3000p ' filename

All right, that's it. This is a small series for you to organize an article on cat, tail, head view the file of any number of lines of data use method.

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.