How to sort a column with $ and ',' '.' sign bash command line?

Viewed 219

I have a file, and i want to use something like "Cat" command on that file which print out the sorted list. For example a column loooks like This

Mike  $1.00
Mason $1,000,000.00
Tyler $100,000.00
Nick  $0.10

Result

Nick  $0.10
Mike  $1.00
Tyler $100,000.00
Mason $1,000,000.00
1 Answers

You can try this

sort -t$ -nk2 fileName

Description :

 -t$  : use $ as separator
 -nk2 : sort using numbers in column 2
Related