You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-p, --fieldseparator (regexp) [use provided regexp to separate fields]
43
45
-g, --grep (regexp) [may repeat, default is accept all]
44
46
-v, --vgrep (regexp) [may repeat, default is reject none]
45
47
-s, --sed (regexp) (replacement) [may repeat, default is no changes]
@@ -48,7 +50,7 @@ tf
48
50
-h, -help, --help
49
51
filename [default is stdin]
50
52
51
-
All the arguments are optional;if none are provided, tf will read records
53
+
All the arguments are optional; if none are provided, topfew will read records
52
54
from the standard input and list the 10 which occur most often.
53
55
```
54
56
## Options
@@ -63,7 +65,7 @@ Specifies which fields should be extracted from incoming records and used in com
63
65
The fieldlist must be a comma‐separated list of integers identifying field numbers, which start at one, for example 3 and 2,5,6.
64
66
The fields must be provided in order, so 3,1,7 is an error.
65
67
66
-
If no fieldlist is provided, **tf** treats the whole input record as a single field.
68
+
If no fieldlist is provided, **topfew** treats the whole input record as a single field.
67
69
68
70
`-p separator, --fieldseparator separator`
69
71
@@ -74,13 +76,13 @@ This is likely to incur a significant performance cost.
74
76
75
77
Some files, for example Apache httpd logs, use space-separation but also
76
78
allow spaces within fields which are delimited by `"`. The -q/--quotedfields
77
-
argument allows **tf** to process these correctly. It is an error to specify both
79
+
argument allows **topfew** to process these correctly. It is an error to specify both
78
80
-p and -q.
79
81
80
82
`-g regexp`, `--grep regexp`
81
83
82
84
The initial **g** suggests `grep`.
83
-
This option applies the provided regular expression to each record as it is read and if the regexp does not match the record, **tf** bypasses it.
85
+
This option applies the provided regular expression to each record as it is read and if the regexp does not match the record, **topfew** bypasses it.
84
86
85
87
This option can be provided multiple times; the provided regular expressions will be applied in the order they appear on the command line.
86
88
@@ -101,19 +103,19 @@ This option can be provided many times, and the replacement operations are perf
101
103
`--sample`
102
104
103
105
It can be tricky to get the regular expressions in the `−g`, `−v`, and `−s` options right.
104
-
Specifying `-−sample` causes **tf** to print lines to the standard output that display the filtering and field‐editing logic.
106
+
Specifying `-−sample` causes **topfew** to print lines to the standard output that display the filtering and field‐editing logic.
105
107
It can only be used when processing standard input, not a file.
106
108
107
109
`-w integer`, `--width integer`
108
110
109
-
If a file name is specified then**tf**, rather than reading it from end to end, will divide it into segments and process it in multiple parallel threads.
111
+
If a file name is specified then**topfew**, rather than reading it from end to end, will divide it into segments and process it in multiple parallel threads.
110
112
The optimal number of threads depends in a complicated way on how many cores your CPU has what kind of cores they are, and the storage architecture.
111
113
112
114
The default is the result of the Go `runtime.NumCPU()` calls and often produces good results.
113
115
114
116
`-h`, `-help`, `--help`
115
117
116
-
Describes the functionand options of **tf**.
118
+
Describes the functionand options of **topfew**.
117
119
118
120
## Records and fields
119
121
@@ -142,10 +144,10 @@ summarizing the request and its result, is delimited by quote characters `"`.
142
144
143
145
The fetch of `picInfo.xml` signals that this is an actual browser request, likely signifying that
144
146
a human was involved; the URL following the `o=` is the resource the human looked at. Here is a
145
-
**tf** invocation that yields a list of the top 5 URLs that were fetched by a human:
147
+
**topfew** invocation that yields a list of the top 5 URLs that were fetched by a human:
Note the `-g` to selectonly lines with `picInfo.xml`, the `-q` to request correct processing
@@ -160,8 +162,8 @@ Therefore, the observed effects of combinations of options can vary dramatically
160
162
For example, if I want to list the top records containing the string `example` from a file named `big-file` I could do either of the following:
161
163
162
164
```shell
163
-
tf -g example big-file
164
-
grep example big-file | tf
165
+
topfew -g example big-file
166
+
grep example big-file |topfew
165
167
```
166
168
167
169
When I benchmark topfew on a modern Apple-Silicon Mac and an elderly spinning-rust Linux VPS, I observe that the first option is faster on Mac, the second on Linux.
0 commit comments