The sed command is easy to use for a single file. If you want to replace all the files in a specified folder, combine grep and sed into a command. The grep command can be used to search for the content of a single file or a file in a folder. The parameter "r" or "-R" can be used to Recursively search for all files in a specified folder; the "l" parameter allows grep to output the file name containing the specified string. After the first successful match, the query on the same file is stopped immediately. If you do not use "l" or "grep" to query a single file, all rows in the output file containing the specified string are output in the format of "File Name: Contains string rows" When querying the folder.
With the knowledge mentioned above, you can write the commands for batch replacement as follows:
Grep "netingcn"-rl/assign-path | xargs sed-I's/netingcn/www \. netingcn/G' or sed-I's/netingcn/www \. netingcn/g''grep "netingcn"-rl/assign-Path'
There is also a complicated writing method:
Grep "netingcn" *-R | awk-F: '{print $1}' | sort | uniq | xargs sed-I's/netingcn/www \. netingcn/G'
The command awk is used to split the string and uniq to deduplicate the result.