Linux finds all files with a character in the folder

Time:2019-11-8

The Linux grep command is used to find strings that match the conditions in the file. The grep instruction is used to find a file whose content contains the specified template style. If the content of a file is found to conform to the specified template style, the default grep instruction will display the column containing the template style. If no file name is specified, or if the given file name is – the grep instruction reads data from the standard input device.

Standard format:

grep -r string ./

Example:

grep -r message ./

Example explanation: recursively find the file containing the string message in the current directory

More about:

-R is recursive search

-N is the display line number

-R find all files including subdirectories

-I ignore case

—Xargs with grep search

find -type f -name '*.php'|xargs grep 'message'

Knowledge point expansion:

Linux looks up whether all files in the directory contain a string

Explain:

-R is recursive search

-N is the display line number

*: indicates all files in the current directory, or a file name.

summary

The above is all the files with a certain character in the Linux search folder introduced by Xiaobian to you. I hope it will help you. If you have any questions, please leave me a message and Xiaobian will reply to you in time. Thank you very much for your support of the developepaer website!
If you think this article is helpful to you, welcome to reprint, please indicate the source, thank you!

Recommended Today

The use of progressbarcontrol, a progress bar control of devexpress – Taking ZedGraph as an example to add curve progress

scene WinForm control – devexpress18 download installation registration and use in vs: https://blog.csdn.net/BADAO_LIUMANG_QIZHI/article/details/100061243 When using ZedGraph to add curves, the number of curves is slower if there are many cases. So in the process of adding curve, the progress needs to be displayed, and the effect is as follows     Note: Blog home page:https://blog.csdn.net/badao_liumang_qizhi […]