I have a file consisting of several lines and columns. The columns are delimited by \t. Now I would like to sort the file based on the second column, which can be done with, e.g.
sort -f -t$'\t' -k2 file.txt. However, the second column consists of the following values:
-. How can I sort such that
+ is on top,
o in the middle, and
- on the bottom?
Furthermore, I have another column, say column 5, and would like to sort the file w.r.t. that column. However, I want to specify my personal order, so that
n is on top,
s is in the middle, and
l is on the bottom.
If there is a program, which can achieve my goals efficiently, I would prefer that solution. Otherwise I'm looking for a self-written function.