-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtreat.1
84 lines (74 loc) · 1.61 KB
/
treat.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
.Dd May 11, 2017
.Dt TREAT 1
.Os
.Sh NAME
.Nm treat
.Nd run different fields through different filters
.Sh SYNOPSIS
.Nm
.Op Fl i Ar insep
.Op Fl o Ar outsep
.Op Ar filters
.Sh DESCRIPTION
.Nm
runs the nth input field from stdin through the nth filter specified
as a cli argument. If no filter is specified for a field, the field is
run through cat. The resulting fields are pasted together and printed
to stdout.
.Sh OPTIONS
.Bl -tag -width Ds
.It Fl i Ar insep
Use
.Ar insep
as the input field separator, defaults to spaces (\(dq \(dq).
.It Fl o Ar outsep
Specify
.Ar outsep
as the output field separator, defaults to tab (\(dq\et\(dq).
.Sh FILES
.Bl -tag -width Ds
.It Pa /tmp/treat.XXXXXX
The temporary directory where treat stores the FIFOs for
piping the different fields.
.El
.Sh EXAMPLES
Emulate cat:
.Pp
.Dl $ treat
.Pp
Print human readable sizes of the different files in the directory tree:
.Pp
.Dl $ du -ab | treat -i '\et' human 'xargs basename -a'
.Pp
Execute sed on only one field:
.Pp
.Dl $ printf 'a b\enc d\eng flbb xq' | treat -o ' ' \(dqsed 's/$/e/'\(dq | tr '\en' '|'
.Dl ae b|ce d|nge flbb xq|
.Pp
Emulate df -h (without the header line):
.Pp
.Dl $ df | sed 1d | tr -s ' ' | awk '{ print($1, $2*1024, $3*1024, $4*1024, $5, $6) }' | treat cat human human human | column -t
.Sh EXIT STATUS
.Ex -std
.Sh BUGS
.Nm
is not able to use
.Sq \en
as a field delimiter.
.Sh SEE ALSO
.Xr awk 1 ,
.Xr basename 1 ,
.Xr cat 1 ,
.Xr column 1 ,
.Xr df 1 ,
.Xr echo 1,
.Xr human 1 ,
.Xr mkfifo 1 ,
.Xr numfmt 1 ,
.Xr paste 1 ,
.Xr pee 1 ,
.Xr sed 1 ,
.Xr tr 1,
.Xr xargs 1 .
.Sh AUTHORS
.An pranomostro Aq Mt [email protected]