Skip to content

Commit b4be2ec

Browse files
authored
Merge branch 'nushell:main' into main
2 parents 653e121 + c67a695 commit b4be2ec

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

sourced/cool-oneliners/find_in.nu

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Search terms in the specified files and/or folders based on the glob pattern provided.
2+
def "find in" [
3+
glob: glob, # the glob expression
4+
...rest: any # terms to search
5+
]: nothing -> table<path: string, line: int, data: string> {
6+
glob $glob
7+
| par-each {|e|
8+
open $e | lines | enumerate | rename line data |
9+
find -c [data] ...$rest |
10+
each {|match| {path: ($e | path relative-to $env.PWD), ...$match}}
11+
} | flatten
12+
}

0 commit comments

Comments
 (0)