Find files in a folder containing a string
Example: Find all files containing "rubyer.me" in the /usr/local directory.
1
|
grep
-lr
'rubyer.me'
/usr/local/
*
|
vim replace all string method in single file
Example: replace all old in the current file with new
1
2
|
:%s
/old/new/g
#%表示替换所有行,g表示替换一行中所有匹配点。
|
Replace files containing strings in a folder
sed combined with grep
example: To change the old in all files under the directory /www to new, do this:
1
|
sed
-i
"s/old/new/g"
`
grep
old -rl
/www
`
|