CAT(1plan9)

πŸ’– NAME πŸ’–

cat, read, nobs β€” catenate files. Yeah bestie, it's the file-gluing trio. 🫢


✨ SYNOPSIS ✨

cat [ file ...  ]
read [ -m ] [ -n nline ] [ file ...  ]
nobs [ file ...  ]

🌸 DESCRIPTION 🌸

cat reads each file in sequence and writes it straight to the standard output. So like:

cat file

prints a file, and

cat file1 file2 >file3

concatenates the first two files and drops the result into the third. Iconic behaviour, no notes. πŸ’…

If you give it no file at all, cat reads from the standard input. Output is buffered in blocks matching the input β€” so it's not doing anything extra, it just moves the data.


read copies to standard output exactly one line from the named file, defaulting to standard input. It's the moment for interactive rc(1) scripts, fr fr.

  • -m β€” makes it keep reading and writing multiple lines until end of file
  • -n β€” makes it read no more than nline lines

read always executes a single write for each line of input, which is lowkey the whole point when you're prepping input for programs that expect line-at-a-time data. And it never reads any more data from the input than it prints to the output. Respectful king. πŸ‘‘


nobs copies the named files to standard output, except it removes all backspace characters and the characters that precede them. It's the move when you want to use it as $PAGER with the Unix version of man(1) while running inside a win window β€” see acme(1). πŸ¦‹


πŸŽ€ SOURCE πŸŽ€

  • /src/cmd/cat.c
  • /src/cmd/read.c
  • /bin/nobs

🌈 SEE ALSO 🌈


πŸ”₯ DIAGNOSTICS πŸ”₯

read exits with status eof on end of file β€” or, in the -n case, if it doesn't read nlines lines. Yes, the exit status is literally the string eof. Periodt. πŸ’€


πŸ‘‘ BUGS πŸ‘‘

Beware of < and > which destroy input files before reading them. Like, the shell will absolutely clobber your file before cat even gets a chance to look at it. Be so careful with this one, bestie, it's giving data loss. 😭

okay that's the whole page, mwah πŸ’–

This was CAT(1plan9) from the Plan 9 manual, section 1 β€” cat, read, nobs, catenating files since forever, and the footer's just CAT(1plan9) right back at ya. πŸŽ€βœ¨

πŸ“¦ where this page comes from