GoGPT Best VPN GoSearch

סמל OnWorks

sortposix - Online in the Cloud

Run sortposix in OnWorks free hosting provider over Ubuntu Online, Fedora Online, Windows online emulator or MAC OS online emulator

This is the command sortposix that can be run in the OnWorks free hosting provider using one of our multiple free online workstations such as Ubuntu Online, Fedora Online, Windows online emulator or MAC OS online emulator

תָכְנִית:

שֵׁם


sort — sort, merge, or sequence check text files

תַקצִיר


sort [−מ] [−o תפוקה] [−bdfinru] [−ת char] [−ק keydef]... [פילה...]

sort [−c|−C] [−bdfinru] [−ת char] [−ק keydef] [פילה]

תיאור


השמיים sort utility shall perform one of the following functions:

1. Sort lines of all the named files together and write the result to the specified
פלט.

2. Merge lines of all the named (presorted) files together and write the result to the
specified output.

3. Check that a single input file is correctly presorted.

Comparisons shall be based on one or more sort keys extracted from each line of input (or,
if no sort keys are specified, the entire line up to, but not including, the terminating
<newline>), and shall be performed using the collating sequence of the current locale.

אפשרויות


השמיים sort כלי השירות יתאים לנפח הגדרות הבסיס של POSIX.1-2008, סעיף
12.2, שירות תחביר הנחיות, except for Guideline 9, and the −ק keydef אפשרות צריכה
עקוב אחרי , , , , −n, ו −ר options. In addition, '+' may be recognized as an
option delimiter as well as '-'.

האפשרויות הבאות יתמכו:

Check that the single input file is ordered as specified by the arguments and
the collating sequence of the current locale. Output shall not be sent to
standard output. The exit code shall indicate whether or not disorder was
detected or an error occurred. If disorder (or, with −u, a duplicate key) is
detected, a warning message shall be sent to standard error indicating where the
disorder or duplicate key was found.

כמו , except that a warning message shall not be sent to standard error if
disorder or, with −u, a duplicate key is detected.

−מ Merge only; the input file shall be assumed to be already sorted.

−o תפוקה Specify the name of an output file to be used instead of the standard output.
This file can be the same as one of the input פילהs.

−u Unique: suppress all but one in each set of lines having equal keys. If used
עם option, check that there are no lines with duplicate keys, in
addition to checking that the input file is sorted.

The following options shall override the default ordering rules. When ordering options
appear independent of any key field specifications, the requested field ordering rules
shall be applied globally to all sort keys. When attached to a specific key (see −ק,)
specified ordering options shall override all global ordering options for that key.

Specify that only <blank> characters and alphanumeric characters, according to
the current setting of LC_CTYPE, shall be significant in comparisons. The
behavior is undefined for a sort key to which or −n also applies.

Consider all lowercase characters that have uppercase equivalents, according to
the current setting of LC_CTYPE, to be the uppercase equivalent for the purposes
of comparison.

Ignore all characters that are non-printable, according to the current setting
of LC_CTYPE. The behavior is undefined for a sort key for which −n גם
חל.

−n Restrict the sort key to an initial numeric string, consisting of optional
<blank> characters, optional minus-sign, and zero or more digits with an
optional radix character and thousands separators (as defined in the current
locale), which shall be sorted by arithmetic value. An empty digit string shall
be treated as zero. Leading zeros and signs on zeros shall not affect ordering.

−ר הפוך את תחושת ההשוואות.

The treatment of field separators can be altered using the options:

Ignore leading <blank> characters when determining the starting and ending
positions of a restricted sort key. If the option is specified before the
ראשון −ק option, it shall be applied to all −ק options. Otherwise, the אוֹפְּצִיָה
can be attached independently to each −ק field_start or field_end אוֹפְּצִיָה-
טיעון (ראה להלן).

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

ניתן לציין מקשי מיון באמצעות האפשרויות:

−ק keydef השמיים keydef argument is a restricted sort key field definition. The format of
הגדרה זו היא:

field_start[סוג][,field_end[סוג]]

איפה field_start ו field_end define a key field restricted to a portion of
the line (see the EXTENDED DESCRIPTION section), and סוג is a modifier from the
list of characters 'ב', ד', 'ו', 'אני', 'N', 'r'. ה 'ב' modifier shall behave
כמו option, but shall apply only to the field_start or field_end ל
which it is attached. The other modifiers shall behave like the corresponding
options, but shall apply only to the key field to which they are attached; they
shall have this effect if specified with field_start, field_end, or both. If any
modifier is attached to a field_start או אל field_end, no option shall apply
to either. Implementations shall support at least nine occurrences of the −ק
option, which shall be significant in command line order. If no −ק האפשרות היא
specified, a default sort key of the entire line shall be used.

When there are multiple key fields, later keys shall be compared only after all
earlier keys compare equal. Except when the −u option is specified, lines that
otherwise compare equal shall be ordered as if none of the options , , ,
−n, או −ק were present (but with −ר still in effect, if it was specified) and
with all bytes in the lines significant to the comparison. The order in which
שורות שעדיין משוות שוות כתובות אינו מוגדר.

אופרנדים


האופרנד הבא יהיה נתמך:

פילה A pathname of a file to be sorted, merged, or checked. If no פילה אופרנדים הם
שצוין, או אם א פילה אופרנד הוא '-', יש להשתמש בקלט הסטנדרטי.

STDIN


יש להשתמש בקלט הסטנדרטי רק אם לא פילה אופרנדים מצוינים, או אם א פילה
אופרנד הוא '-'עיין בסעיף קבצי קלט.

קלט קבצים


The input files shall be text files, except that the sort utility shall add a <newline> to
the end of a file ending with an incomplete last line.

הסביבה וריאציות


משתני הסביבה הבאים ישפיעו על הביצוע של sort:

שפה ספק ערך ברירת מחדל עבור משתני הבינאום שאינם מוגדרים או
ריק. (ראה את הכרך של הגדרות הבסיס של POSIX.1-2008, סעיף 8.2,
בינאום משתנים בעד הבכורה של בינאום
משתנים המשמשים לקביעת הערכים של קטגוריות מקומיות.)

LC_ALL אם מוגדר לערך מחרוזת לא ריקה, עוקף את הערכים של כל האחרים
משתני בינאום.

LC_COLLATE
קבע את המיקום עבור כללי ההזמנה.

LC_CTYPE קבע את המקום לפרשנות של רצפים של בתים של נתוני טקסט
כתווים (לדוגמה, בייט בודד לעומת תווים מרובי בייטים ב
arguments and input files) and the behavior of character classification for the
, , , , ו −n אפשרויות.

LC_MESSAGES
קבע את המקום שבו יש להשתמש כדי להשפיע על הפורמט והתוכן של
הודעות אבחון שנכתבו לפי שגיאת תקן.

LC_NUMERIC
Determine the locale for the definition of the radix character and thousands
separator for the −n אוֹפְּצִיָה.

NLSPATH קבע את המיקום של קטלוגי הודעות לעיבוד של LC_MESSAGES.

אסינכרוני אירועים


בְּרִירַת מֶחדָל.

STDOUT


אלא אם כן ה −o or options are in effect, the standard output shall contain the sorted
קֶלֶט.

STDERR


The standard error shall be used for diagnostic messages. When is specified, if
disorder is detected (or if −u is also specified and a duplicate key is detected), a
message shall be written to the standard error which identifies the input line at which
disorder (or a duplicate key) was detected. A warning message about correcting an
incomplete last line of an input file may be generated, but need not affect the final exit
מעמד.

תפוקה קבצים


אם −o option is in effect, the sorted input shall be written to the file תפוקה.

מורחבים תיאור


The notation:

−ק field_start[סוג][,field_end[סוג]]

shall define a key field that begins at field_start ומסתיים בשעה field_end כָּלוּל,
אלא אם כן field_start falls beyond the end of the line or after field_end, in which case the
key field is empty. A missing field_end shall mean the last character of the line.

A field comprises a maximal sequence of non-separating characters and, in the absence of
אוֹפְּצִיָה −ת, any preceding field separator.

השמיים field_start חלק של keydef option-argument shall have the form:

field_number[.first_character]

Fields and characters within fields shall be numbered starting with 1. The field_number
ו first_character pieces, interpreted as positive decimal integers, shall specify the
first character to be used as part of a sort key. If .first_character is omitted, it shall
refer to the first character of the field.

השמיים field_end חלק של keydef option-argument shall have the form:

field_number[.last_character]

השמיים field_number shall be as described above for field_start. השמיים last_character קטע,
interpreted as a non-negative decimal integer, shall specify the last character to be used
as part of the sort key. If last_character evaluates to zero or .last_character is
omitted, it shall refer to the last character of the field specified by field_number.

אם אפשרות או b type modifier is in effect, characters within a field shall be
counted from the first non-<blank> in the field. (This shall apply separately to
first_character ו last_character.)

יְצִיאָה סטָטוּס


יוחזרו ערכי היציאה הבאים:

0 All input files were output successfully, or was specified and the input file was
correctly sorted.

1 Under the option, the file was not ordered as specified, or if the ו −u
options were both specified, two input lines were found with equal keys.

>1 אירעה שגיאה.

השלכות OF שגיאות


בְּרִירַת מֶחדָל.

השמיים הבא סעיפים יש לו אִינפוֹרמָטִיבִי.

בקשה נוהג


ערך ברירת המחדל עבור −ת, <blank>, has different properties from, for example,
−ת"<space>". If a line contains:

<space><space>foo

the following treatment would occur with default separation as opposed to specifically
selecting a <space>:

┌──────┬───────────────────┬──────────────┐
שדהבְּרִירַת מֶחדָל−ת "<space>"
├──────┼───────────────────┼──────────────┤
│ 1 │ <space><space>foo │ ריק
│ 2 │ ריקריק
│ 3 │ ריק │ foo │
└──────┴───────────────────┴──────────────┘
The leading field separator itself is included in a field when −ת is not used. For
example, this command returns an exit status of zero, meaning the input was already
sorted:

sort −ק 2 <<eof
y<tab>b
x<space>a
eof

(assuming that a <tab> precedes the <space> in the current collating sequence). The field
separator is not included in a field when it is explicitly set via −ת. This is historical
practice and allows usage such as:

sort −ת "|" −ק 2n <<eof
Atlanta|425022|Georgia
Birmingham|284413|Alabama
Columbia|100385|South קרוליינה
eof

where the second field can be correctly sorted numerically without regard to the non-
numeric field separator.

The wording in the OPTIONS section clarifies that the , , , , −n, ו −ר אפשרויות
have to come before the first sort key specified if they are intended to apply to all
specified keys. The way it is described in this volume of POSIX.1‐2008 matches historical
practice, not historical documentation. The results are unspecified if these options are
specified after a −ק אוֹפְּצִיָה.

השמיים option might not work as expected in locales where there is not a one-to-one
mapping between an uppercase and a lowercase letter.

דוגמאות


1. The following command sorts the contents of בקובץ with the second field as the sort
מפתח:

sort −ק 2,2 בקובץ

2. The following command sorts, in reverse order, the contents of infile1 ו infile2,
placing the output in אוסף and using the second character of the second field as
the sort key (assuming that the first character of the second field is the field
separator):

sort −ר −o אוסף −ק 2.2,2.2 infile1 infile2

3. The following command sorts the contents of infile1 ו infile2 using the second
non-<blank> of the second field as the sort key:

sort −ק 2.2b, 2.2b infile1 infile2

4. The following command prints the System V password file (user database) sorted by the
numeric user ID (the third <colon>-separated field):

sort −ת : −ק 3,3n / etc / passwd

5. The following command prints the lines of the already sorted file בקובץ, suppressing
all but one occurrence of lines having the same third field:

sort −um −ק 3.1,3.0 בקובץ

Rationalale


Examples in some historical documentation state that options −um with one input file keep
the first in each set of lines with equal keys. This behavior was deemed to be an
implementation artifact and was not standardized.

השמיים −z option was omitted; it is not standard practice on most systems and is inconsistent
עם שימוש sort to sort several files individually and then merge them together. The text
לגבי −z in historical documentation appeared to require implementations to determine
the proper buffer length during the sort phase of operation, but not during the merge.

השמיים −y option was omitted because of non-portability. The option, present in System V,
was omitted because of non-portability in international usage.

An undocumented −T option exists in some implementations. It is used to specify a
directory for intermediate files. Implementations are encouraged to support the use of the
TMPDIR environment variable instead of adding an option to support this functionality.

השמיים −ק option was added to satisfy two objections. First, the zero-based counting used by
sort is not consistent with other utility conventions. Second, it did not meet syntax
guideline requirements.

Historical documentation indicates that ``setting −n מרמז ''. The description of −n
already states that optional leading <blank>s are tolerated in doing the comparison. If
is enabled, rather than implied, by −n, this has unusual side-effects. When a character
offset is used in a column of numbers (for example, to sort modulo 100), that offset is
measured relative to the most significant digit, not to the column. Based upon a
recommendation from the author of the original sort שירות, ה implication has been
omitted from this volume of POSIX.1‐2008, and an application wishing to achieve the
previously mentioned side-effects has to code the flag explicitly.

גרסאות קודמות של תקן זה אפשרו את −o option to appear after operands.
Historical practice allowed all options to be interspersed with operands. This version of
the standard allows implementations to accept options after operands but conforming
applications should not use this form.

Earlier versions of this standard also allowed the -מספר ו +מספר אפשרויות. אלה
אפשרויות אינן מצוינות עוד על ידי POSIX.1‐2008 אך עשויות להיות קיימות בחלקן
מימושים.

Historical implementations produced a message on standard error when צוין ו
disorder was detected, and when ו −u were specified and a duplicate key was detected.
An earlier version of this standard contained wording that did not make it clear that this
message was allowed and some implementations removed this message to be sure that they
conformed to the standard's requirements. Confronted with this difference in behavior,
interactive users that wanted to be sure that they got visual feedback instead of just
exit code 1 could have used a command like:

sort פילה || הד הפרעה

whether or not the sort utility provided a message in this case. But, it was not easy for
a user to find where the disorder or duplicate key occurred on implementations that do not
produce a message, especially when some parts of the input line were not part of the key
and when one or more of the , , , , −n, או -r options or keydef type modifiers
were in use. POSIX.1‐2008 requires a message to be produced in this case. POSIX.1‐2008
also contains the option giving users the ability to choose either behavior.

When a disorder or duplicate is found when the option is specified, some
implementations print a message containing the first line that is out of order or contains
a duplicate key; others print a message specifying the line number of the offending line.
This standard allows either type of message.

FUTURE כיוונים


אין.

Use sortposix online using onworks.net services


שרתים ותחנות עבודה בחינם

הורד אפליקציות Windows & Linux

פקודות לינוקס

Ad




×
פרסומת
❤️קנו, הזמינו או קנו כאן - ללא עלות, עוזר לשמור על שירותים בחינם.