Raven - Example Scripts
Search for text in files
#!/usr/local/bin/raven # search <path> <mask> <regex> # search ~/raven '*.c' 'include' # search `pwd` '*' 'some text' ARGS 2 get './' prefer as $path ARGS 3 get '*.*' prefer as $ext ARGS 4 get '' prefer as $text # Build a list of files to check. 'find %($path)s/ -name "%($ext)s" | grep -v svn' format shell trim LF split as $files $files each as $file $file isfile if # split file into a list of lines $file read trim LF split stack # filter out lines that do not match $regex $text regex filter as $matches was empty not if # display the path of the file relative to cwd $file $path length over length extract "\n%s\n" format print # print matching lines $matches each pair as $i , $l $l trim $i 1 + "%5d %s\n" format print
|