• SQL

    Us the ORDER BY Keyword With Your SQL SELECT Statements

    The ORDER BY keyword in a SQL SELECT statement is used to sort a given result-set based on the contents of one or more columns of data. By default, results are in ascending order, but you can use either ASC or DESC to indicate that you’d like results sorted in ascending or descending order, respectively. Below is a selection from the “Customers” table that we will use to run some SQL sorting statements using the ORDER BY keyword: ID Site Contact Address City Zip Country 1 Krypted Charles Edge my house Minneapolis 55418 US 2 Apple Tim Cook spaceship Cupertino 95014 US 3 Microsoft Satya Nadella campus Redmond 98053 US…

  • Mac OS X,  Ubuntu,  Unix,  Xsan

    Uniq Logs

    Recently I’ve been looking at a lot of log files. And sorting through them can be a bit of a pain. However, there are some tools out there to help make this process a bit easier. The first of these is sort. If I have a log that has 1,000 lines, while I like to initially see any lines that are repeated numerous times so that I can see when servers are throwing a lot of errors, combing through them can get tedious. Sort will help to reduce the volume and organize them in a manner that makes sense. For example, to sort the logs and remove duplicate line entries…

  • Mac OS X,  Mac OS X Server,  Ubuntu,  Unix

    Piping Commands

    The pipe (|) character is used to combine multiple commands. A pipe is a temporary storage place where the output of one command is stored and then passed as the input for a second command. Pipes are used to run more than two commands from the same command line.  The sort command is used to sort data. When you run the ls –l command, you will see a listing of the files in a directory with each file shown on a separate line. When you use a pipe after the command and then sort your results, you will sort the data listed on the screen by the list command. The…