So in this example the output of grep is passed to the next command sed as its argument. This is a little command-line utility that takes what receives in input and passes it as argument to another program. l - print results as a simple list of file names.R - perform a recursive search, also across symbolic links. ![]() Here I'm invoking it with the following parameters: ![]() Grep is a utility for searching for strings through multiple text files. Let me now dissect it and take a quick look at the different tools in use. Assuming that you want to search for the string search through multiple files and replace it with replace, this is the one-liner: grep -RiIl 'search' | xargs sed -i 's/search/replace/g' After a bit of research I've come up with a nice solution. ![]() Often times I need to search and replace a string of text across multiple files in my Linux box.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |