LAM(1)
π LAM(1) β laminate files, bestie
okay so picture this: you've got a bunch of files, and you want them all lined up side by side instead of stacked. that's lam. it's from the General Commands Manual section of your friendly neighbourhood manual pages, and it is lowkey the most underrated little utility ever. let's get into it π«Ά
β¨ SYNOPSIS β¨
lam [-F|f min.max] [-P|p min.max] [-S|s sepstring] [-T|t c] file ...
like, that's it. that's the whole vibe check. π
π¦ DESCRIPTION π¦
okay so lam copies the named files side by side onto the standard output. the way it works is: the n-th input lines from all the input files get treated as fragments of one single long n-th output line, and it just... assembles them. iconic behaviour honestly β¨
and the name - means the standard input, and β this is the fun part β it can be repeated. so you can eat the same stdin multiple times. no cap. π₯
the options are as follows, and yes i'm listing every single one because i love you:
πΈ OPTIONS πΈ
-F|f min.maxβ print line fragments according to the format stringmin.max, whereminis the minimum field width andmaxis the maximum field width. ifminbegins with a zero, zeros get prepended to make up the field width instead of blanks, and if it begins with a-, the fragment gets left-adjusted within the field. so bougie β¨
also: if -f is used, it affects only the file after it; if -F is used, it affects all subsequent files until it appears again uncapitalized. yes bestie the case matters, capital letters have main character energy here.
-P|p min.maxβ like-f, but pad this file's field when end-of-file is reached and other files are still active. so it keeps the column open even after that file runs out of lines. thoughtful π
if -p is used, it affects only the file after it; if -P is used, it affects all subsequent files until it appears again uncapitalized. same deal as above.
-S|s sepstringβ printsepstringbefore printing line fragments from the next file. and yes, this option may appear after the last file, which is a fun little quirk, love that for us π
if -s is used, it affects only the file after it; if -S is used, it affects all subsequent files until it appears again uncapitalized. pattern recognition, you see it π
-T|t cβ the input line terminator iscinstead of a newline. and the newline normally appended to each output line gets omitted. so you're swapping out the whole line-ending situation, periodt.
if -t is used, it affects only the file after it; if -T is used, it affects all subsequent files until it appears again uncapitalized. ok you literally know the drill by now π
ngl if you just want to print files simultaneously for easy viewing, go usepr(1)instead.lamis for laminating, not for looking pretty. different lanes, different vibes. π
π ENVIRONMENT π
LC_CTYPEβ the character encodinglocale(1). it determines the display widths of characters used by the-fand-poptions. and here's the tea: if it's unset, or set to"C","POSIX", or an unsupported value, then every byte is regarded as a character of display width1. so like, don't expect fancy wide characters in that mode π§
β EXAMPLES β
join four files together along each line β the classic, the moment, the icon:
$ lam file1 file2 file3 file4
merge the lines from four different files (look at the escaped newline in the sepstring, it's giving β¨artisticβ¨):
$ lam file1 -S "\
" file2 file3 file4
join every two lines of a file β this one reads stdin twice, obsessed:
$ lam - - < file
and a form letter with substitutions keyed by β@β can be done with:
$ lam -t @ letter changes
ate. no crumbs. π₯
π SEE ALSO π
join(1), pr(1), printf(1) β go give them a read, they're all besties π
π HISTORY π
the lam utility first appeared in 4.2BSD. yes, it's old. yes, it still slays. vintage is a vibe π¦
π AUTHORS π
John A. Kunze β thank you king, we appreciate you π
and that's the whole page bestie!! this Debian rendition is dated December 2, 2021 π« so go laminate something cute, and remember: keep the facts exact, keep the energy immaculate. mwah πβ¨
π¦ where this page comes from
- alpine 3.24: outils-doc 0.14-r0 Β· BSD-3-Clause ISC
- nixos 26.05: outils 0.13
- nixpkgs unstable: outils 0.13
- Copyright (c) 1993 The Regents of the University of California. All rights reserved
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms