Search
// Search for multiple files using shell
Find.-Type F | xargs grep flash
Note:
Find the files in the previous directory and Its subdirectories that contain Flash files.
//
Record the xargs command:
Xargs obtains the parameter list and one row in the standard input, and then sends them to another command in a large group (determined by the arg_max value of the host, this command is used as the xargs parameter.
How to view arg_max values:
Getconf arg_max
//
//
Search for multiple files and replace them with commands.
Grep flash $ (find.-Type F)
Note:
$ () Is a command replacement, with shell commands in parentheses. Shell executes the commands in parentheses and replaces $ (...) with the command output.
There are two methods to replace a command: $ () and two reverse quotation marks pair find.-Type F pair.
Replace
// Replace-sed in multiple files
To ensure that the replacement should not be replaced, first find out in the file which will be replaced
Find-type F! -Path '*. SVN *' | xargs sed-n'/ookong INC/P'
Note:
1. Find first filters out the. SVN directory and Its subdirectories.
2. xargs sends parameters to the SED command
3. Sed performs a search and only prints the rows that meet the requirements.
//
// Replace
Find-type F! -Path '*. SVN *' | xargs sed-I's/ookong INC/ookong Ltd. co./G'
Note:
1. Sed's I option is directly replaced in the file, instead of printing the replacement result.
2.g replace all the matches in each line.
//
//
In addition, a Perl multi-file search Program : ACK
-- Display the row number and file
Vim find replacement (see http://www.cnblogs.com/mo-beifeng/archive/2011/10/02/2198303.html)
Other Replacement Methods:
One is the mahuinan method, the other is the sumly method, and the other is the 30 t method as follows: