Created
February 9, 2011 21:12
-
-
Save figital/819293 to your computer and use it in GitHub Desktop.
fstring
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /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: sudo cp fstring /usr/local/bin | |
find $1 -type f -exec grep $2 \{\} /dev/null \; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I think I should make the directory parameter optional ... since you'd normally already be in the location you're about to search, right?