Order MySQL result by occurence of a field
SELECT `row`, COUNT(row) AS `count`, FROM `table` GROUP BY `row` ORDER BY `count`;
Sometimes it is necessary, to sort the rows of a MySQL select statement by the occurence of a field value.
SELECT `row`, COUNT(row) AS `count`, FROM `table` GROUP BY `row` ORDER BY `count`;
Sometimes it is necessary, to sort the rows of a MySQL select statement by the occurence of a field value.
/// <summary> /// Counts the lines of a File. /// </summary> /// <param name="fileToCount">The file to count.</param> /// <returns>lines of a File</returns> private static int CountLines(string fileToCount) { int counter = 0; using (StreamReader countReader = new StreamReader(fileToCount)) { while (countReader.ReadLine() != null) counter++; } return counter; }
wc -l `find . -name "*.php" -print` | tail -1 | awk '{print $1}'
Searches for all .php files in the current directory and all subdirectories and outputs the total amount of lines.
Most popular snippets