Skip to content

Instantly share code, notes, and snippets.

@hwms
Created July 9, 2015 11:00
Show Gist options
  • Select an option

  • Save hwms/1ea10c16683e33da0761 to your computer and use it in GitHub Desktop.

Select an option

Save hwms/1ea10c16683e33da0761 to your computer and use it in GitHub Desktop.

Revisions

  1. hwms created this gist Jul 9, 2015.
    12 changes: 12 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@
    #!/bin/bash
    for F in "$@"; do
    DEFS=`grep -E '^ *def|^ *class' ${F} | sed -e 's/^ *//g' | cut -d ' ' -f 2 | cut -d '(' -f 1 | cut -d ':' -f 1 | sort | sed ':a;N;$!ba;s/\n/\n/g' | uniq`
    #echo $DEFS
    for D in $DEFS; do
    COUNT=`grep -rn $D | wc -l`
    #echo $D $COUNT
    if [ $COUNT -eq 1 ]; then
    grep -rn $D
    fi
    done
    done