Script question...

Xpression admin at atenas.cult.cu
Mon Jan 12 15:04:38 PST 2004


Hi list, I've making a script to write the content of three text files to
one file, but I want to separate each files by a delimiter like the name of
the file.

This is the script:

#! /bin/sh
path=/some/dir
if !([ -f $path/this.one ]); then
    for file in $path/file1 $path/file2 $path/file3; do
 cat $file >> $path/this.one
    done
fi

exit 0

By now the output is:

 Contents of file1
 Contents of file2
 Contents of file3

And I want to be like this:
-----------------------------------------------------------------------
  file1
-----------------------------------------------------------------------
 Contents of file1
-----------------------------------------------------------------------
 file2
-----------------------------------------------------------------------
 Contents of file2
-----------------------------------------------------------------------
  file3
-----------------------------------------------------------------------
 Contents of file3

any suggestion ??? Thanks...



More information about the freebsd-questions mailing list