From c15765432990a6b3af80078c1772126a8df903aa Mon Sep 17 00:00:00 2001 From: zeus Date: Mon, 5 Oct 2020 14:47:34 +0300 Subject: [PATCH] fine and grep 1 --- .../codeanswer | 2 +- .../codehelp | 37 +++++++++++++++++++ find/2_Combine_find_and_grep_with_exec/q-info | 9 ++--- 3 files changed, 41 insertions(+), 7 deletions(-) diff --git a/find/2_Combine_find_and_grep_with_exec/codeanswer b/find/2_Combine_find_and_grep_with_exec/codeanswer index cbe505b..f0ee32b 100644 --- a/find/2_Combine_find_and_grep_with_exec/codeanswer +++ b/find/2_Combine_find_and_grep_with_exec/codeanswer @@ -1 +1 @@ -find /usr -type f -perm 0777 | grep conf +find /usr/share -name "*.py" -type f -size +10000c -executable -exec grep -Hnsw "return" {} \; diff --git a/find/2_Combine_find_and_grep_with_exec/codehelp b/find/2_Combine_find_and_grep_with_exec/codehelp index e69de29..7135d42 100644 --- a/find/2_Combine_find_and_grep_with_exec/codehelp +++ b/find/2_Combine_find_and_grep_with_exec/codehelp @@ -0,0 +1,37 @@ + +The -size switch explained: + +-size n[cwbkMG] + + File uses n units of space. The following suffixes can be used: + + `b' for 512-byte blocks (this is the default if no suffix is + used) + + `c' for bytes + + `w' for two-byte words + + `k' for Kilobytes (units of 1024 bytes) + + `M' for Megabytes (units of 1048576 bytes) + + `G' for Gigabytes (units of 1073741824 bytes) + + The size does not count indirect blocks, but it does count + blocks in sparse files that are not actually allocated. Bear in + mind that the `%k' and `%b' format specifiers of -printf handle + sparse files differently. The `b' suffix always denotes + 512-byte blocks and never 1 Kilobyte blocks, which is different + to the behaviour of -ls. + + +Notice the + after the size switch. + + +try + +find /usr/share -name "*.py" -type f -size -10000c -executable -exec grep -Hnsw "return" {} \; + + +Notice the - after the size switch. diff --git a/find/2_Combine_find_and_grep_with_exec/q-info b/find/2_Combine_find_and_grep_with_exec/q-info index 9dab397..342142e 100644 --- a/find/2_Combine_find_and_grep_with_exec/q-info +++ b/find/2_Combine_find_and_grep_with_exec/q-info @@ -1,9 +1,6 @@ -Try to run +Try to -[source,sh] ----- -find /usr -type f -perm 0777 | grep conf ----- +find all files with extension .py and exec permissions, grep only rows that contain *return* word. -and see the Results! +Show files bigger than 10000 bytes.