SMH@SRI-KL.ARPA (06/25/84)
From: "Scott M. Hinnrichs" <SMH@SRI-KL.ARPA> I use 'more' to generate a stream of files separated by 'pretty' headers. This is very handy when moving files via tape to a system without tar/cpio. Just do 'more file_names... > output_file'. Why isn't it in cat? Well have you heard the one about cat -v ?... Scott -------
jerryp@tektronix.UUCP (06/25/84)
> Does anyone know why "cat" doesn't seem to have a flag... > to simply list files with an indication of the name of the file > preceeding the contents, separated from the data by a special > character or a newline or two... ? It's not documented, but if you give head(1) more than one file to read, it spits out a filename before each one, this way: % head foo.c foo.man ==> foo.c <== (contents of foo.c) ==> foo.man <== (contents of foo.man) % Normally, head gives only the first ten lines... but something like % head -200 foo.c foo.man should give a complete listing of any but the longest files. --Jerry Peek, UNIX Training Instructor, Tektronix, Inc. US Mail: MS 76-036, P.O. Box 500, Beaverton, OR 97077 uucp: {allegra,decvax,hplabs,ihnp4,mit-eddie,ucbvax}!tektronix!jerryp CSnet: jerryp@tek ARPAnet: jerryp.tek@csnet-relay Phone: 503/627-1603
jds@rlgvax.UUCP (06/26/84)
A little UNIX(tm) trivia before the holy war gets out of hand. ----- Category: origin of command names. cat - an abbreviation for "CATch-all" -- like its namesake, this command received all features which didn't clearly belong anywhere else. pr - an abbreviation for "Put everything heRe" -- the cat command soon outgrew the limited address space of the PDP 11, prompting the creation of this second "all purpose" command. So, feel free to glom all the functionality you want onto these commands -- that's what they're there for. ----- With ~17 options for S5 "pr" and ~8 options for 4.2BSD "cat", one begins to wonder. Jack Slingwine {seismo,ihnp4,allegra}!rlgvax!jds
jmoore@opus.UUCP (Jim Moore) (06/26/84)
You could add a flag to cat (maybe -n if it is not already used) to get the names of the argument files printed, but if cat -v is considered harmful, cat -n is probably cruel and unusual. Have you considered writing a shell script? Jim Moore NBI, Boulder Colorado [ucbvax | hao | amd]!nbires!jmoore
guy@rlgvax.UUCP (Guy Harris) (06/27/84)
> You could add a flag to cat (maybe -n if it is not already used) to > get the names of the argument files printed, Unfortunately, in 4.1BSD "cat -n" *is* already used - it does line numbering. As does the "nl" command in USG UNIX - with more options than you can shake a stick at, if that's your idea of a good time (apologies to Julius Marx); anybody actually used all the logical page etc. stuff therein? As does, for that matter, the "-n" option to the "pr" command in USG UNIX. I guess they *do* stand for "CATchall" and "Put everything heRe"... Guy Harris {seismo,ihnp4,allegra}!rlgvax!guy
snafu@ihuxi.UUCP (Dave Wallis) (06/28/84)
> Does anyone know why "cat" doesn't seem to have a flag... > to simply list files with an indication of the name of the file > preceeding the contents, separated from the data by a special > character or a newline or two... ? There are several lsolutions to this problem. If you have access to experimental tools (ATT only), the "more" command does what you want. If you don't have more, the folllowing shell script should work nicely: for i in $* do echo "***** $i *****\n" /bin/cat $i done Put this in a file called "cat" in your own bin directory (or any directory for that matter), and make sure that the directory will be searched before /bin (i.e. PATH=$HOME/bin:$PATH) and voila! you now have a cat command that identifies the files before printing them. -- Dave Wallis ihnp4!ihuxi!snafu AT&T Technologies, Inc. (312) 979-5894
smk@axiom.UUCP (Steven M. Kramer) (06/28/84)
cat -n is already used to number lines (replaces old num command like cat -v replaces old see command). I am neutral on this discussion and only want to point out the facts. -- --steve kramer {allegra,genrad,ihnp4,utzoo,philabs,uw-beaver}!linus!axiom!smk (UUCP) linus!axiom!smk@mitre-bedford (MIL)
guy@rlgvax.UUCP (Guy Harris) (07/03/84)
> There are several lsolutions to this problem. If you have access to > experimental tools (ATT only), the "more" command does what you want. Well, if you have access to 4.xBSD, or to a version of UNIX to which somebody has ported the 4.xBSD "more" command, it does what you want also. Guy Harris {seismo,ihnp4,allegra}!rlgvax!guy
laman@sdcsvax.UUCP (07/07/84)
System V.2's "pg" puts the name of the file first if there is more than one file. Almost what you want. Mike Laman UUCP: {ucbvax,philabs,sdccsu3,sdcsla}!sdcsvax!laman