add grep and xargs

This commit is contained in:
onceupon 2017-10-11 15:49:28 +08:00 committed by GitHub
parent b7b1a844ff
commit 6b7d0d3edb

View File

@ -88,8 +88,13 @@ grep -Rh bbo /path/to/directory
or
```bash
grep -rh bbo /path/to/directory
```
or only list filename with match
```bash
grep -rl bbo /path/to/directory
```
##### Grep OR (e.g. A or B or C or D)
```
@ -662,6 +667,12 @@ ls|xargs wc -l
cat grep_list |xargs -I{} grep {} filename
```
##### Xargs and sed (replace all old ip address with new ip address under /etc directory)
```bash
grep -rl '192.168.1.111' /etc | xargs sed -i 's/192.168.1.111/192.168.2.111/g'
```
## Find
[[back to top](#handy-bash-oneliner-commands-for-tsv-file-editing)]
##### List all sub directory/file in the current directory