simon / Grep

Last active 1 month ago

simon revised this gist 1 month ago · 55b966b

1 file changed, 19 insertions

grep.md (file created)
@@ -0,0 +1,19 @@
1 + # grep
2 +
3 + * grep for $string1 AND $string2:
4 +
5 + ```
6 + grep -RiE 'rabbit.*guest' /etc/*
7 + ```
8 +
9 + * diff files and show only common lines:
10 +
11 + ```
12 + grep -F -x -f file1 file2
13 + ```
14 +
15 + * find all files containing a string and run sed command against them:
16 +
17 + ```
18 + files=$(git grep -l "kind: HelmRelease" | grep -v gotk) && echo $files | xargs sed -i 's/v2beta1/v2beta2/g'
19 + ```