|
Every once in a while, you sit down on your BSD system and it just so happens that you can use the system utilities to best advantage..
What is the best command line you've ever typed?
My current fave:
(This PHP script generated errors to stdout. I wanted a unique list of error records to use in an IN (...) clause of an SQL statement)
cat convert.php | php -q -c /usr/local/etc | awk '{print $7;}' | sort -u | sed -e 's/(//g' | sed -e 's/)/,/g' | xargs echo > error.log
That takes output like this:
Error: 0.20, 0, 125, 100.00, 0.00 (543)
Error: 0.00, 0, 125, 100.00, 0.00 (544)
Error: 84.00, 0, 125, 100.00, 0.00 (545)
Error: 347.00, 0, 125, 100.00, 0.00 (545)
Error: 4.60, 0, 125, 100.00, 0.00 (545)
And produces this:
543, 544, 545
Please comment with your favourites!
|