-
Notifications
You must be signed in to change notification settings - Fork 12
/
tlc.1
136 lines (136 loc) · 3.42 KB
/
tlc.1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
.\" $OpenBSD$
.\"
.\"
.\" Copyright (c) 2021 Vadim Zhukov <[email protected]>
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.Dd $Mdocdate: May 5 2021 $
.Dt TLC 1
.Os
.Sh NAME
.Nm tlc
.Nd count input line interactively
.Sh SYNOPSIS
.Nm
.Op Fl fp
.Op Fl d Ar delim
.Op Fl e Ar end
.Op Fl i Ar interval
.Op Fl s Ar start
.Op Ar text
.Sh DESCRIPTION
The
.Nm
utility reads lines from standard input and, by default,
regularly updates summary line with increasing count of lines read
on standard error descriptor.
.Pp
If
.Ar text
is specified, it is appended to summary line.
.Pp
The options are as follows:
.Bl -tag -width Ds
.It Fl d Ar delim
Changes delimiter used to split input lines to
.Ar delim .
Can be any string; the empty
.Ar delim
is interpreted as
.Ql \e\\&0 .
Default is newline character.
.It Fl e Ar end
Display progress in terms of percents instead of line numbers.
The 100% mark will be achivied upon reading
.Ql end-start
lines.
Also enables the
.Sq %p
format code, see below.
It is now allowed to set
.Ar end
less than or equal to
.Ar start .
.It Fl f
Makes
.Ar text
interpreted as format string to be used for displaing summary.
The following format codes are supported:
.Bl -tag -width ws
.It %%
Encodes single percent sign.
.It %i
Replaced with number of lines read.
.It %p
Replaced with progress value, like:
.Ql 42
(the percent sign is not included automatically).
In case of absent
.Ar end ,
this format code does nothing.
.It %s
Replaced with last line read; empty if no lines were read yet.
.El
Every other combination of percent sign and some character will
result in outputting them literally.
.It Fl i Ar interval
Sets minimal number of seconds between summary line updates to
.Ar interval .
This helps to avoid flickering due too often screen updates.
If set to zero, screen will be updated upon each input line read.
Default value is 1 second.
.It Fl p
Enables passthrough mode: every input line gets duplicated on
standard output.
.It Fl s Ar start
Sets initial value of lines read to
.Ar start .
Defaults to 0.
It is now allowed to set
.Ar start
larger than or equal to
.Ar end ,
unless the latter was not specified at all.
.El
.Sh EXIT STATUS
.Ex -std tlc
.Sh EXAMPLES
Show file removal progress:
.Bd -literal -offset indent
$ rm -Rv foo | tlc 'files removed'
42 files removed...
.Ed
.Pp
and eventually the line above will evolve into:
.Bd -literal -offset indent
1764 files removed.
$
.Ed
.Pp
Monitor files as being pushed on pipe:
.Bd -literal -offset indent
$ find /usr/lib -type f -name '*.so' |
tlc -pf '%i file found: %s' |
xargs -J % objdump -p % >plugins.log
37 file found: /usr/lib/kid3/libkid3-core.so
<...>
1337 file found: /usr/lib/libkdeinit5_kile.so
$
.Ed
.Sh SEE ALSO
.Xr getline 3
.Sh AUTHORS
.Nm
was written by
.An Vadim Zhukov Aq Mt [email protected] .