Posts Tagged ‘one liner’

Quick SVN stats one liner

Friday, September 26th, 2008

I needed a quick list of contributors to our repository, this one liner is nice and easy.

svn log -q | awk '/^r/ {print $3}' | sort | uniq -c

Linux/PHP one liner – Syntax check all files.

Tuesday, March 25th, 2008

Here’s a simple one liner you can use to syntax check all php files in your working directory.

find . -type f -name "*.php" -exec php -l {} \; | grep -v 'No syntax errors'

For those not familiar with the programs used, it basically reads as…. Find all files that end in ‘.php’ and with each of those files run php -l. This is then put through a pipe to the grep -v, which filters out all files that are syntactically correct.