Linux sort Tutorial

Linux sort Primer Tutorial

Linux sort Tutorial

If you were to nominate the most frequent “chore” you set your “software programs” to do, and we should never forget we are here to make software that achieves something, there is a big chance you’d choose the job of sorting data. The why I guess relates to how a lot of we humans want data presented … we seek order … and are generally a bit afraid of chaos … whether this is good always is for 56784532 other conversations to have.

Let’s go back to a thinking close to the operating system of interest … and today that is Linux … and look at some command line Linux that will work on most/all Linux or Unix operating systems … it is pretty fundamental stuff.

The base command of interest may amaze you … are you ready …


sort [inputFile]

… gasp … but sort just like that assumes some of the defaults (depending on your deep configuration settings (ie. in your profile, with an alias, you can change them)) …

  • alphabetical sorting
  • total record sorting (as if all the characters on a carriage return/line feed delimited string)
  • ascending sort (from least to greatest)
  • the sort determination looks from the leftmost character and proceeds to the right

… but, today, with our piped sort commands we present switches that can change the first three defaults, respectively …

  • -n
  • -k [colNumber] -t[delimiterCharacter]
  • -r

… in other words …

  • numerical sort
  • sort by field [colNumber] where fields are separated by [delimiterCharacter]
  • descending sort

We also touch on other commands with our look at Linux sorting of our input CSV data that we talked about with PHP/Javascript/HTML Google Chart JSON Data Table Import of CSV Tutorial as shown below that has fields “Country”,”Population”,”Crude Birth Rate” …

  • cat [CSVfileName] … type a file called [CSVfileName]
  • uniq … pipe to enforce record uniqueness
  • sort -u … pipe and switch to enforce field (of record) uniqueness
  • grep ‘[searchCriteria]’ … piped filter to include only records satisfying [searchCriteria]
  • sed ‘/$/s//,5/g’ … piped record modifier adding a new column (ie. ,5) to right of our input CSV data

Hope you find some interest in this Linux operating system command discussion. This is raw command line talk but it can also be supervised as a useful component tool by, (amongst other ideas by) …

  • web server side language supervision … eg. via PHP exec for example, or via curl (of that PHP)
  • called by compiled desktop program, such as Java, C++, C
  • called by a Linux/Unix shell script … in Bourne Shell, Korn Shell, C Shell, tcsh, Unix Shell

Previous relevant data from PHP/Javascript/HTML Google Chart JSON Data Table Import of CSV Tutorial is shown below.

PHP/Javascript/HTML Google Chart JSON Data Table Import of CSV Tutorial

PHP/Javascript/HTML Google Chart JSON Data Table Import of CSV Tutorial

Here is a tutorial that introduces you to Google Graphs API, or Google Chart Tools, and its JSON Data Table functionality.

Google Chart Tools provide a perfect way to visualize data on your website. From simple line charts to complex hierarchical tree maps, the chart galley provides a large number of well-designed chart types. Populating your data is easy using the provided client- and server-side tools.

Thanks to the World Bank for some statistics which helped a lot.

Let’s see some PHP code in live action for this tutorial where you see a JSON Data Table derived from a filename passed as a parameter in the URL. The data shown is based on a CSV file of a previous PHP/Javascript/HTML Google Chart Intensity Map Tutorial shown below.

Link to Google Chart Tools “spiritual home” … via Google.
Link to Google Chart Tools JSON Data Table information … via Google.

Link to some downloadable PHP programming code … rename to chart_editor_in.php.
Link to some downloadable PHP programming code … rename to json_data_table.php.
Link to some downloadable input CSV data … rename to Google_Chart_Intensity_Chart_Tutorial_as.CSV.


Previous PHP/Javascript/HTML Google Chart Intensity Map Tutorial below …

PHP/Javascript/HTML Google Chart Intensity Map Tutorial

PHP/Javascript/HTML Google Chart Intensity Map Tutorial

Here is a tutorial that introduces you to Google Graphs API, or Google Chart Tools, and its Intensity Map functionality.

Google Chart Tools provide a perfect way to visualize data on your website. From simple line charts to complex hierarchical tree maps, the chart galley provides a large number of well-designed chart types. Populating your data is easy using the provided client- and server-side tools.

Thanks to the World Bank for some statistics which helped a lot.

Let’s see some PHP code in live action for this tutorial where you define your intensity map characteristics and data.

Now part of an Android App called Geo Chart++ in July 2013.

Link to Google Chart Tools “spiritual home” … via Google.
Link to Google Chart Tools Intensity Map information … via Google.

Link to some downloadable PHP programming code … rename to intensity_chart.php.

If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.

This entry was posted in eLearning, Operating System, Tutorials and tagged , , , , , , , , , , , , , , . Bookmark the permalink.

13 Responses to Linux sort Tutorial

  1. Bonjour ! ca fais rΓͺver comme site !

  2. spam scam says:

    Appreciate the recommendation. Will try it out.|

  3. Anyways thanks for your ideas. I appreciate it. Please make more posts connected to this

  4. Anyways many thanks for your suggestions. I value it. Please make more short articles related to this

  5. Anyways many thanks for your concepts. I appreciate it. Please make even more write-ups related to this

  6. What i don’t understood is actually how you are no longer really a lot more well-appreciated than you might be now. You are so intelligent. You already know therefore significantly on the subject of this matter, made me individually believe it from so many varied angles. Its like men and women aren’t interested until it is something to accomplish with Woman gaga! Your personal stuffs great. Always maintain it up!

  7. Hertha Frie says:

    I’ve been exploring for any bit for any high high quality articles or blog posts on this type of region . Exploring in Yahoo I at last stumbled upon this web site. Reading this information and facts So i’m pleased to convey that I’ve a very excellent uncanny feeling I found precisely what I needed. I most definitely will be certain to do not neglect this site and give it a glance on a constant basis.

  8. I and my pals have been taking note of the excellent points found on your website while all of a sudden got an awful suspicion I had not expressed respect to you for them. All the ladies ended up glad to read through them and now have definitely been having fun with them. Thank you for truly being indeed accommodating and also for considering this sort of great useful guides most people are really desperate to be informed on. My very own sincere regret for not saying thanks to sooner.

  9. I have been examinating out many of your articles and i can state nice stuff. I will make sure to bookmark your site.

  10. clothes says:

    As a Newbie, I am constantly searching online for articles that can be of assistance to me. Thank you

  11. I would like to thank you for the efforts you’ve put in writing this blog. I am hoping the same high-grade web site post from you in the upcoming also. In fact your creative writing skills has inspired me to get my own website now. Actually the blogging is spreading its wings quickly. Your write up is a good example of it.

  12. Hey very cool website!! Guy .. Beautiful .. Amazing .. I will bookmark your web site and take the feeds alsoΒ‘KI am happy to seek out so many useful info right here within the post, we want work out extra strategies in this regard, thanks for sharing. . . . . .

  13. Excellent publish from specialist also it will probably be a fantastic know how to me and thanks really much for posting this helpful data with us all.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>