Home >System Tutorial >LINUX >How to use the grep command to query the contents of a specific first and last file
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.
2. Find TERMINAL on the left taskbar and open the terminal window.
3. Add ^ after grep to specify the beginning of a certain line.
4. Add $ to the content after to specify the end of a certain line.
5 and ^$ can use at the same time to specify the necessary content at the beginning and end of a certain line.
6, If there is a missing or incorrect character in the middle, it will not be queried.
7. Use it with -i to ignore the rules of upper and lower case.
8. You can alsouse it with -v and -i, and use it flexibly
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!