Skip to content
Advertisement

Sorting a tab delimited file

I have a data with the following format:

JavaScript

Now I tried to sort the file based on the last field decreasingly. I tried the following commands but it wasn’t sorted as we expected.

JavaScript

What’s the right way to do it?

Here is the sample data.

Advertisement

Answer

Using bash, this will do the trick:

JavaScript

Notice the dollar sign in front of the single-quoted string. You can read about it in the ANSI-C Quoting sections of the bash man page.

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement