Posted By

ferro on 01/28/12


Tagged

grep find awk


Versions (?)

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


 / Published in: Bash
 

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

  1. find . -name \*.php -exec grep -Hi "PATTERN TO FIND" {} \; | awk -F":" '{gsub(/^\t*/,"",$2);gsub(/ *$/,"",$2);gsub(/^ */,"",$2);printf("%-50s:%s\n", $1, $2);}'

Report this snippet  

You need to login to post a comment.