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