Re: sort Frage

From: David Lothar Felkel <felkeld(at)in.tum.de>
Date: Wed, 15 Aug 2007 13:29:55 +0200

Harold Gutch schrieb:
> On Wed, Aug 15, 2007 at 11:48:56AM +0200, David Lothar Felkel wrote:
>
>> Harold Gutch schrieb:
>>
>>> Mh, jein. Das funktioniert eben auch nur wenn man zumindest ein
>>> Zeichen kennt das garantiert nicht vorkommt, per Default eben ein
>>> Whitespace:
>>>
>>> > printf "1234567890bcdef\n2234567890abcde\n" | sort -k 1.11,1.15
>>> 2234567890abcde
>>> 1234567890bcdef
>>>
>>> aber
>>>
>>> > printf "1 34567890bcdef\n2234567890abcde\n" | sort -k 1.11,1.15
>>> 1 34567890bcdef
>>> 2234567890abcde
>>>
>>>
>> Bei mir klappt das wunderbar - es wird richtig sortiert. Whitespace wird
>> doch nicht per default als delimiter genommen oder?
>>
>
> Zumindest nicht laut der Manpage:
>
> -t separator
> Use character separator as the field separator when finding the
> sort keys in each line. By default, fields are separated by the
> empty string between a non-whitespace character and a whitespace
> character.
>
>
>
>> Ich muss allerdings dazu auch sagen, dass ich das hier auf einem älterem
>> GNU Linux teste. Hast du das live auf einem BSD getestet?
>>
>
> Ja, allerdings auf einem (etwas betagteren) FreeBSD 4.11. Auf -CURRENT
> scheint sort so zu sortieren wie von dir erwartet, und ebso auf einem
> Linux-System, auf dem ich es eben getestet habe. Das widerspricht
> allerdings ebenso dem wie ich die Manpages lese:
>
> FreeBSD-CURRENT:
>
> -t, --field-separator=SEP use SEP instead of non-blank to blank transi-
> tion
>
> Linux (welche Distribution, weiß ich leider nicht genau):
>
> -t SEP use SEParator instead of non- to whitespace transi-
> tion
>
>
In der Manpage müsste allerdings etwas weiter unten stehen, dass beim
Angeben von Positionen in Feldern die ganze Zeile als Feld interpretiert
wird, wenn kein weiterführender Key angegeben wird (z.B. 1.1b für
nonblank-charactersequences)

SuSE Linux 9.3 (coreutils 5.0, 03/2003)
"POS is F[.C][OPTS], where F is the field number and C the character
position in the field. OPTS is one or more sin­gle-letter ordering
options, which override global order­ing options for that key. If no key
is given, use the entire line as the key."

Mit freundlichen Grüßen,
David

To Unsubscribe: send mail to majordomo(at)de.FreeBSD.org
with "unsubscribe de-bsd-questions" in the body of the message
Received on Wed 15 Aug 2007 - 13:33:40 CEST

search this site