Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 12 Jan 2004 18:04:20 -0500
From:      "Xpression" <admin@atenas.cult.cu>
To:        "FreeBSD-questions" <freebsd-questions@FreeBSD.ORG>
Subject:   Script question...
Message-ID:  <001601c3d960$696a5550$0901a8c0@bloodlust>

next in thread | raw e-mail | index | archive | help
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...



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?001601c3d960$696a5550$0901a8c0>