Linux grep\head\tail Command Use (Sixth chapter)

Source: Internet
Author: User
The Grep\head\tail command uses

Test.txt
1
2
3
4
5
6
7
8
9
10
Test
Liyao
Oldboy

grep command:
1. Exclude text content including Oldbody characters (grep-v command exclusions)
[[email protected] kang]# grep -v "oldboy" test.txt
1
2
3
4
5
6
7
8
9
10
Test
Liyao

2. Find only files that contain oldbody characters.

[[email protected] kang]# grep "oldboy" test.txtoldboy

Head Header command
1. Find the first 5 lines of data in a file
[[email protected] kang]# head -n 5 test.txt
1
2
3
4
5

Tail Tail command
1. Find 3 rows of data after the file
[[email protected] kang]# tail -n 3 test.txt#默认后10行
Liyao
Oldboy

2.tail Dynamic View Back
[[email protected] kang]# tail -fn 100 test.txt

Linux grep\head\tail Command Use (Sixth chapter)

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.