I have a csv file called prices.csv that looks like this:
Name, Price, Description
Apple, 2.85, fruit
Kiwi, 1.96, fruit
Banana, 0.99, fruit
Peach, Not available, fruit
Orange, 2.02, fruit
I would like to sort the second column (Price) in ascending order, except for the values that are 'Not available', these should be placed at the bottom.
What I've done so far is this:
sort -t, -k2,2 -n prices.csv > ordered_prices.csv
This creates the following file:
Name, Price, Description
Peach, Not available, fruit
Banana, 0.99, fruit
Kiwi, 1.96, fruit
Orange, 2.02, fruit
Apple, 2.85, fruit
As you can see this places the products with price 'Not available' at the top instead of at the bottom. How do I place the text at the bottom with generic code?