Skip to content

Commit bfaf1e0

Browse files
committed
Add example
1 parent 112be16 commit bfaf1e0

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

tools/dev.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,15 @@ If you encounter an error due to too many arguments, use `xargs`.
100100
$ find ./search/directory -type f | xargs perl -pi -w -e 's/search/replace/g;'
101101
```
102102

103+
If running a search from the top-level directory, be sure to exclude any hidden directories (including `.git`), the top-level `node_modules` directory, and the `./deps` directory from the search. This may require using absolute file paths.
104+
105+
``` bash
106+
$ find "$PWD" -type f -not -path "$PWD/.*" -not -path "$PWD/deps/*" -not -path "$PWD/node_modules/*" | xargs perl -pi -w -e 's/search/replace/g;'
107+
```
108+
103109
A few comments:
104110

105111
* For simple cases, [`sed`][sed-find-and-replace] may be faster.
106-
* If running a search from the top-level directory, be sure to exclude any hidden directories (including `.git`), the top-level `node_modules` directory, and the `./deps` directory from the search (e.g., `-not -path "./deps"`). This may require using absolute file paths.
107112
* Be __very__ careful when performing a multi-file find and in-place replace. Perform dry-runs and confirm expected results on a small file subset __before__ performing on many files. You have been __warned__.
108113

109114

0 commit comments

Comments
 (0)