LAM(1)

πŸ“¦
version 0.14 Β· 3 versions
, in alpine 3.24, nixos 26.05, nixpkgs unstable

πŸ’… 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 string min.max, where min is the minimum field width and max is the maximum field width. if min begins 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 β€” print sepstring before 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 is c instead 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 use pr(1) instead. lam is for laminating, not for looking pretty. different lanes, different vibes. πŸ’…

πŸ’œ ENVIRONMENT πŸ’œ

  • LC_CTYPE β€” the character encoding locale(1). it determines the display widths of characters used by the -f and -p options. 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 width 1. 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