4.2 pr and split filters
Commands to learn:
pr (1) - prepare file(s) for printing, even in multiple columns
split (1) - split a file into pieces
10. The pr command (filter) is a formatter for use with the lp command to
print pages. By default, the listing is separated into pages, each headed
by the page number, a date and time, and the name of the file. By default,
columns are of equal width, separated by at least one space; lines which
do not fit are truncated. (The symbol # requires a number in its place)
pr [-#] [-adfmt] [-e#i#n#w#] [-h "title"] [files...]
Examples:
Print file1 and file2 as a double-spaced, three-column listing headed
by "file list":
$ pr -3dh "file list" file1 file2
Write file1 on file2, expanding tabs to columns 10, 19, 28, 37, ... :
$ pr -e9 -t file2
Print file1 in default format with non-blank lines numbered down the
left side:
$ nl file1 | pr
11. the split command (filter) is the opposite of the cat command.
split reads file and writes it in pieces (default 1000 lines) onto a
set of output files. The name of the first output file is name with
aa appended, and so on lexicographically, up to zz (only ASCII letters
are used, a maximum of 676 files). If no output name is given, x is
the default.
split [-l linecount] [-b bytecount|bytesk|bytesm ] [file [name] ]
Examples:
$ split bigfile jar
$ ls jar*
jaraa
jarab
jarac
$ split -l66 printedfile
ls x*
xaa
xab
xac
xad
xae
xaf
xag
xah
xai
Questions? Robert Katz: rkatz@ned.highline.edu
Last Update July 16, 2002