In Linux operations, we often replace and count strings in files. Let's do a summary now. If there are any mistakes, please criticize and correct them. Count the number of strings grep -c str filename grep -o str filename |wc -l Replace String Replace the current line with the matching string Replace all matches in the current file :%s/original string/replacement string/gg Batch replace string sed -i "s/search field/replace field/g" grep search field-rl path -rl means all subdirectories sed -i "s/new Str/old Str/g" 'grep "old Str" -rl filename' PS: Linux commonly used string operation commands Split string by space Split a string at specific characters Cutting a string Remove specific characters from a string Summarize The above is the relevant operation skills for organizing strings in Linux introduced by the editor. I hope it will be helpful to everyone. If you have any questions, please leave me a message and the editor will reply to you in time. I would also like to thank everyone for their support of the 123WORDPRESS.COM website! You may also be interested in:
|
<<: MySQL uses init-connect to increase the implementation of access audit function
>>: Vue project configures webpack-obfuscator to implement code encryption and obfuscation
I reinstalled the computer and installed the late...
Table of contents 1. JavaScript is single-threade...
1. Vue--The first vue-cli program The development...
This article example shares the specific code for...
Preparation Windows Server 2008 R2 Enterprise (2....
Static files Nginx is known for its high performa...
Pull the image root@EricZhou-MateBookProX: docker...
The paging effect is implemented in the vue proje...
Table of contents Constructing payment methods us...
summary In some scenarios, there may be such a re...
Table of contents Component Communication Introdu...
Table of contents Overview 1. Parent component pa...
Native JS implements the click number game for yo...
Of course, it also includes some personal experien...
If there is a table product with a field add_time...