174
Comment:
|
832
|
Deletions are marked like this. | Additions are marked like this. |
Line 1: | Line 1: |
Describe Linux/FindGrepAwkSed here. | ## page was renamed from Linux/FindGrepAwkSed Describe Linux/FindGrepAwkSedXargs here. |
Line 5: | Line 6: |
* [[regex]] only part of grep match returned == Search dir for files containing string and replace all of them == {{{ ##e.g. search for tentant -> tenant grep -irlZ 'tentant' ./ | xargs -0 sed -i 's/tentant/tenant/g' }}} == Bash loop over files == * Rather than using find and xargs, use globing to find and process files in bash * e.g. {{{ #By enabling the globstar option, you can glob all matching files in this directory and all subdirectories: # Make sure globstar is enabled shopt -s globstar for i in **/*.txt; do # Whitespace-safe and recursive process "$i" done }}} |
Describe Linux/FindGrepAwkSedXargs here.
Find files containing something in Linux
https://swcarpentry.github.io/shell-novice/07-find/index.html
regex only part of grep match returned
Search dir for files containing string and replace all of them
##e.g. search for tentant -> tenant grep -irlZ 'tentant' ./ | xargs -0 sed -i 's/tentant/tenant/g'
Bash loop over files
- Rather than using find and xargs, use globing to find and process files in bash
e.g.
#By enabling the globstar option, you can glob all matching files in this directory and all subdirectories: # Make sure globstar is enabled shopt -s globstar for i in **/*.txt; do # Whitespace-safe and recursive process "$i" done