by uggedal · 17y ago · 0 comments
# a visual recursive list of all files and directories
function tree()
{
find . | sed -e 's/[^\/]*\//|--/g' -e 's/-- |/ |/g' | $PAGER
}
# recursive text search (ack is also nifty)
function f()
{
find . -name '*' | xargs grep -l $1
}
# recursive search and replace (ignoring hidden files and dirs), example: replace foo bar
function replace()
{
find . \( ! -regex '.*/\..*' \) -type f | xargs perl -pi -e "s/$1/$2/g"
} epy () {
cmd="import $1 as a ; print a.__file__.endswith('.pyc') and a.__file__[:-1] or a.__file__"
file=$(/usr/bin/env python -c $cmd)
echo $file
emacsclient --no-wait $file
}