Sortieren nach Spalten statt Feldern

F

FrankSchmitz

Jungspund
Guten Morgen allerseits!

ich hätte da ein Skript-Defizit und hoffe, dass mir da jmd. weiter helfen kann...

Den sort habe ich bisher nur angewendet, indem ich mit Feldtrenner nach bestimmten Feldern sortiert habe.
Im man habe ich jetzt nicht direkt was gefunden, wie nach bestimmten Spalten sortiert werden kann.
:think:
Weiss jmd. Rat?
 
Was meinst du mit Spalten?

Bei Solaris kannst du IMHO auch den Feldseparator festlegen.

-t char
Use char as the field separator character. char is not considered to be part of a field (although it can be included in a sort key). Each occurrence of char is significant (for example, <char><char> delimits an empty field). If -t is not specified, blank characters are used as default field separators; each maximal non-empty sequence of blank characters that follows a non-blank character is a field separator.

Auch die Key Option ist wie bei GNU sort -k
-k keydef
The keydef argument is a restricted sort key field definition. The format of this definition is:


-k field_start [type] [,field_end [type] ]



where:

field_start and field_end
define a key field restricted to a portion of the line.
type
is a modifier from the list of characters bdfiMnr. The b modifier behaves like the -b option, but applies only to the field_start or field_end to which it is attached and characters within a field are counted from the first non-blank character in the field. (This applies separately to first_character and last_character.) The other modifiers behave like the corresponding options, but apply only to the key field to which they are attached. They have this effect if specified with field_start, field_end or both. If any modifier is attached to a field_start or to a field_end, no option applies to either.



When there are multiple key fields, later keys are compared only after all earlier keys compare equal. Except when the -u option is specified, lines that otherwise compare equal are ordered as if none of the options -d, -f, -i, -n or -k were present (but with -r still in effect, if it was specified) and with all bytes in the lines significant to the comparison.

Schau dir mal die Beispiele auf dieser Online Manpage an.

Gruß Wolfgang
 

Ähnliche Themen

Keine grafische Oberfläche (Debian Installation)

CSV Datei mit sed manipulieren/optimieren/ergänzen

[Tcl / Shell] Ändern einer Datei per vi - Änderungsdatum einer Datei erfassen

Linux VPN-Server für WinXP SP2 Clients

OpenSuse10.1 Auf Nvidia Raid0

Zurück
Oben