uspTukubaiコマンドに関する様々な資料がここにあります。

 

 

魂内検索

DOCUMENTS

COMMAND

FORUM

UEC DOCS

VIDEO

 

Alphabetical list

(Video materials in preparation)

order

Name

order : Returns the order of the record within a block of

        records that share the same key value.

Synopsis

Usage   : juni [<k1> <k2>] <file>

          juni key=<key> <file>

Option  : -h

Version : Thu May 22 18:11:29 JST 2014

Description

Inserts a number at the beginning of each record representing

the record's position within a block of records that share the

same key field. The key field is defined as fields <k1> through

<k2>.

If you omit <k1> and <k2>, all records are considered to share

the same key value. In this case the result is to add a line

number to the beginning of all records.

The -h option causes each key field's order to be displayed

heirarchically.

If <file> is not specified or specified as "-" then the command

reads from standard input.

Example 1

Add line numbers to a file.

$ cat data

0000007 Celery 100

0000017 Carrot 95

0000021 Orange 80

0000025 Melon 70

0000030 Potato 30

$ order data

1 0000007 Celery 100

2 0000017 Carrot 95

3 0000021 Orange 80

4 0000025 Melon 70

5 0000030 Potato 30

Example 2

If you specify the key start field and the key end

field, the number attached represents the order of the

record within the block of records sharing the same

key value.

$ cat data

Mid_Atlantic Pasta 100

Mid_Atlantic Rice_Cake 90

Mid_Atlantic Bread 40

九州 Rice_Cake 150

九州 Bread 140

九州 Pasta 100

$ order 1 1 data

1 Mid_Atlantic Pasta 100

2 Mid_Atlantic Rice_Cake 90

3 Mid_Atlantic Bread 40

1 九州 Rice_Cake 150

2 九州 Bread 140

3 九州 Pasta 100

Example 3

The -h option causes each key field's order to be displayed

heirarchically.

$ cat data

A A1 A11 A111

A A1 A11 A112

A A1 A12 A121

A A1 A12 A122

A A2 A21 A211

A A2 A21 A212

A A2 A22 A221

A A2 A22 A222

B B1 B11 B111

B B1 B11 B112

B B1 B12 B121

B B1 B12 B122

B B2 B21 B211

B B2 B21 B212

B B2 B22 B221

B B2 B22 B222

$ order -h 1 3 data

1 1 1 A A1 A11 A111

1 1 1 A A1 A11 A112

1 1 2 A A1 A12 A121

1 1 2 A A1 A12 A122

1 2 1 A A2 A21 A211

1 2 1 A A2 A21 A212

1 2 2 A A2 A22 A221

1 2 2 A A2 A22 A222

2 1 1 B B1 B11 B111

2 1 1 B B1 B11 B112

2 1 2 B B1 B12 B121

2 1 2 B B1 B12 B122

2 2 1 B B2 B21 B211

2 2 1 B B2 B21 B212

2 2 2 B B2 B22 B221

2 2 2 B B2 B22 B222

Example 4

If you specify the -h option without specifying

the key, then the key is considered to consist

of all fields from the first to the last.

$ order -h data

1 1 1 1 A A1 A11 A111

1 1 1 2 A A1 A11 A112

1 1 2 1 A A1 A12 A121

1 1 2 2 A A1 A12 A122

1 2 1 1 A A2 A21 A211

1 2 1 2 A A2 A21 A212

1 2 2 1 A A2 A22 A221

1 2 2 2 A A2 A22 A222

2 1 1 1 B B1 B11 B111

2 1 1 2 B B1 B11 B112

2 1 2 1 B B1 B12 B121

2 1 2 2 B B1 B12 B122

2 2 1 1 B B2 B21 B211

2 2 1 2 B B2 B21 B212

2 2 2 1 B B2 B22 B221

2 2 2 2 B B2 B22 B222

See Also

rank  command