xref: /freebsd/usr.bin/lam/lam.1 (revision 783d3ff6d7fae619db8a7990b8a6387de0c677b5)
1.\" Copyright (c) 1993
2.\"	The Regents of the University of California.  All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\"    notice, this list of conditions and the following disclaimer.
9.\" 2. Redistributions in binary form must reproduce the above copyright
10.\"    notice, this list of conditions and the following disclaimer in the
11.\"    documentation and/or other materials provided with the distribution.
12.\" 3. Neither the name of the University nor the names of its contributors
13.\"    may be used to endorse or promote products derived from this software
14.\"    without specific prior written permission.
15.\"
16.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
17.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
20.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26.\" SUCH DAMAGE.
27.\"
28.Dd April 7, 2015
29.Dt LAM 1
30.Os
31.Sh NAME
32.Nm lam
33.Nd laminate files
34.Sh SYNOPSIS
35.Nm
36.Op Fl f Ar min . Ns Ar max
37.Op Fl s Ar sepstring
38.Op Fl t Ar c
39.Ar
40.Nm
41.Op Fl p Ar min . Ns Ar max
42.Op Fl s Ar sepstring
43.Op Fl t Ar c
44.Ar
45.Sh DESCRIPTION
46The
47.Nm
48utility copies the named files side by side onto the standard output.
49The
50.Em n-th
51input lines from the input
52.Ar files
53are considered fragments of the single long
54.Em n-th
55output line into which they are assembled.
56The name `\fB\-\fP' means the standard input, and may be repeated.
57.Pp
58.Bl -tag -width indent
59.It Fl f Ar min . Ns Ar max , Fl F Ar min . Ns Ar max
60Print line fragments according to the format string
61.Ar min . Ns Ar max ,
62where
63.Ar min
64is the minimum field width and
65.Ar max
66the maximum field width.
67If
68.Ar min
69begins with a zero, zeros will be added to make up the field width,
70and if it begins with a `\-', the fragment will be left-adjusted
71within the field.
72Using
73.Fl f
74applies only to the next file while
75.Fl F
76applies to all subsequent files until it appears again uncapitalized.
77.It Fl p Ar min . Ns Ar max , Fl P Ar min . Ns Ar max
78Like
79.Fl f ,
80but pad this file's field when end-of-file is reached
81and other files are still active.
82Using
83.Fl p
84applies only to the next file while
85.Fl P
86applies to all subsequent files until it appears again uncapitalized.
87.It Fl s Ar sepstring , Fl S Ar sepstring
88Print
89.Ar sepstring
90before printing line fragments from the next file.
91This option may appear after the last file.
92Using
93.Fl s
94applies only to the next file while
95.Fl S
96applies to all subsequent files until it appears again uncapitalized.
97.It Fl t Ar c , Fl T Ar c
98The input line terminator is
99.Ar c
100instead of a newline.
101The newline normally appended to each output line is omitted.
102Using
103.Fl t
104applies only to the next file while
105.Fl T
106applies to all subsequent files until it appears again uncapitalized.
107.El
108.Pp
109To print files simultaneously for easy viewing use
110.Xr pr 1 .
111.Sh EXAMPLES
112The command
113.Bd -literal
114lam file1 file2 file3 file4
115.Ed
116.Pp
117joins 4 files together along each line.
118To merge the lines from four different files use
119.Bd -literal
120lam file1 \-S "\\
121" file2 file3 file4
122.Ed
123.Pp
124Every 2 lines of a file may be joined on one line with
125.Bd -literal
126lam \- \- < file
127.Ed
128.Pp
129and a form letter with substitutions keyed by `@' can be done with
130.Bd -literal
131lam \-t @ letter changes
132.Ed
133.Sh SEE ALSO
134.Xr join 1 ,
135.Xr paste 1 ,
136.Xr pr 1 ,
137.Xr printf 3
138.Sh STANDARDS
139Some of the functionality of
140.Nm
141is standardized as the
142.Xr paste 1
143utility by
144.St -p1003.2 .
145.Sh HISTORY
146The
147.Nm
148utility first appeared in
149.Bx 4.2 .
150.Sh AUTHORS
151.An John A. Kunze
152.Sh BUGS
153The
154.Nm
155utility does not recognize multibyte characters.
156