Find a pattern on a code base and show a pretty resultset

/ Published in: Bash
Save to your folder(s)

trims spaces from the source code and left align the code column

Copy this code and paste it in your HTML
  1. find . -name \*.php -exec grep -nHi "PATTERN TO FIND" {} \; | awk -F":" '{gsub(/^\t*/,"",$2);gsub(/ *$/,"",$2);gsub(/^ */,"",$2);printf("%-50s:%s\n", $1, $2);}'

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.