Sorting Issue

Hi Guys,

I am very new to Unix.Can anyone tell me how to sort a file based on fields.

For example, I am having a file whose contents are mentioned below:

 	 	 	 	 	     2233|charles harris  |g.m.     |sales     |12/12/52| 90000    9876|bill johnson    |director |production|03/12/50|130000    5678|robert dylan    |d.g.m.   |marketing |04/19/43| 85000    2365|john woodcock   |director |personnel |05/11/47|120000     Each line contains emp-id, name, designation, department, date of    birth, and salary.

How to sort the file on the basis of salary?
How to get unique designations?

Regards,

Mahesh Raghunandanan

Type

man sort

to get the sort manual which describes sorting by columns.
But to be brutally honest, the easiest way is to open the file in Excel (other spreadsheets will do!), split the columns and hit the Sort menu option!:eek:

sort -t "|" -k 6 -n -r sortsalary.txt
9876|bill johnson |director |production|03/12/50|130000
2365|john woodcock |director |personnel |05/11/47|120000
2233|charles harris |g.m. |sales |12/12/52|90000
5678|robert dylan |d.g.m. |marketing |04/19/43|85000

sort -t"|" -n -r +5 filename