Home >System Tutorial >LINUX >How to use the grep command to query the contents of a specific first and last file

How to use the grep command to query the contents of a specific first and last file

王林
王林forward
2024-01-09 09:45:57994browse

In the LINUX system, if you want to view the contents of a file, how can you view the first and last contents of a specified file? Let's take a look at the tutorial on using grep to query the contents of the specified first and last files.

1. Open LINUX, here we can use the UBUNTU operating system.

How to use the grep command to query the contents of a specific first and last file

2. Find TERMINAL on the left taskbar and open the terminal window.

How to use the grep command to query the contents of a specific first and last file

3. Add ^ after grep to specify the beginning of a certain line.

How to use the grep command to query the contents of a specific first and last file

4. Add $ to the content after to specify the end of a certain line.

How to use the grep command to query the contents of a specific first and last file

5 and ^$ can use at the same time to specify the necessary content at the beginning and end of a certain line.

How to use the grep command to query the contents of a specific first and last file

6, If there is a missing or incorrect character in the middle, it will not be queried.

How to use the grep command to query the contents of a specific first and last file

7. Use it with -i to ignore the rules of upper and lower case.

How to use the grep command to query the contents of a specific first and last file

8. You can alsouse it with -v and -i, and use it flexibly

How to use the grep command to query the contents of a specific first and last file

How to use the grep command to query the contents of a specific first and last file

The above is the detailed content of How to use the grep command to query the contents of a specific first and last file. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:jb51.net. If there is any infringement, please contact admin@php.cn delete