I need to replace a string in a lot of files in a folder, with only ssh
access to the server. How can I do this?
相关问题
- how to split a list into a given number of sub-lis
- Is shmid returned by shmget() unique across proces
- Generate string from integer with arbitrary base i
- how to get running process information in java?
- Converting a string array to a byte array
"You could also use find and sed, but I find that this little line of perl works nicely.
" (Extracted from http://www.liamdelahunty.com/tips/linux_search_and_replace_multiple_files.php)
My best results come from using perl and grep (to ensure that file have the search expression )
Similar to Kaspar's answer but with the g flag to replace all the occurrences on a line.
For global case insensitive:
If you have list of files you can use
If you have all files you can use
If you have list of files with extension, you can use
In case your string has a forward slash(/) in it, you could change the delimiter to '+'.
This command would run recursively in the current directory.