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

王林
Release: 2024-01-09 09:45:57
forward
993 people have browsed it

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!

Related labels:
source:jb51.net
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template