Little question on "cat"

Dave Wallis snafu at ihuxi.UUCP
Thu Jun 28 07:01:07 AEST 1984


>  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



More information about the Comp.unix mailing list