Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
21 lines (14 sloc) 754 Bytes
#! /bin/bash
# description: search a directory for a string, output filenames and context
# usage: fstring /tmp/whatever mysearch
# example: fstring ./ hello (search current directory for string "hello"
# better example:
# sfitchet@crunchbang:/tmp/myapp$ fstring ./ array_slice
# ./docs/code-reviews/rick.txt:5. /public_html/widgets/twitter/index.php //
# line 16, for perf, cache array_slice($tweets, 0, 5) in a var, PHP is //
# dumb and will actually run # that code EVERY time the loop runs
# ./public_html/widgets/twitter/cache.php: $tweets = array_slice($tweets, 0, 5);
# installation:
# wget https://raw.github.com/figital/fstring/master/fstring
# sudo cp fstring /usr/local/bin
find $1 -type f -exec grep $2 \{\} /dev/null \;