vim is a commonly used text editor for Linux. By using multiple shell commands to find and replace multiple files, what specific commands will you use? The following small series will introduce you to the Linux system vim multi-file search and replace method.
On the linux platform, there are many excellent shell command to do a combination of multi-file search /replace, such as these commands: find, sed, grep, awk, perl. But other platforms such as Windows are not so convenient. At this time, vim's built-in multi-file search command is useful, although it is slightly slower than external commands.
vim multi-file lookup
This vim built-in command is vimgrep, there are two basic ways to use:
:vim[grep][! ] /{pattern}/[g][j] {file} . . .
:vim[grep][! ] {pattern} {file} . . .
The file part supports wildcards, * represents the current directory, ** represents the current directory and its subdirectories (recursive), such as */*.c represents the c source file in the current directory, **/*. c represents all source files in the current directory and its recursive subdirectories. The file part can be specified multiple times.
The following command looks at the matching result:
:cn[ext] Next result
:cp[revious] Previous result
:cw[indow ] quickfix window, list of result files
For more detailed usage see: help vimgrep and refs below.
vim multi-file replacement
In fact, you can just use the following two commands (assuming you want to replace the hate in the file with the extension .txt/.cpp in the current directory with love) :
:args *.txt *.cpp :argdo %s/hate/love/gc
Linux users use the ssh compiler script, the The authenticity of host can & rsquo; t be xx establish
The ioctl function is mainly used to control I/O devices. It can implement the common method of user
Install the system on the virtual machine to complete the system test. Many people
In Linux system, in addition to PHP can view the file directory, the shell command
How to use rz/sz tool for file transfer in Linux
What should I do if ssh is slow to connect to other Linux machines?
Linux Ubuntu tab key auto-completion command method
Ubuntu install Nox, compile make error, what should I do?
Summary of usage of Linux chmod commands
Red Flag Linux Desktop 5 How to Use SAPGUI Client
Solve the problem of installing Linux prompt Boot Efi does not have space to set up
Linux system vim how to install vundle component
How to solve the problem of cant find libjava.so under Ubuntu?
Ubuntu using the command to delete the PPA repository
Learn to use the character set encoding of tool conversion files in Linux systems
WindowsServer2003 three practical small flexible technology
Windows7 "Qian Jing" is not known Use habits to restrict Win7 promotion
How to upgrade win10? Win10 Enterprise Edition Permanent Activation Tutorial
Win10 system touchpad gesture operation manual
Reasons and solutions for IE not browsing online
How to install Kaspersky 2015 security software in win10?
What is the difference between the power mode of logout/sleep/hibernation in Win10 system?