Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 13 Jan 2004 00:24:10 +0100 (CET)
From:      "Julien Gabel" <jpeg@thilelli.net>
To:        freebsd-questions@freebsd.org
Subject:   Re: Script question...
Message-ID:  <50121.192.168.0.97.1073949850.squirrel@webmail.thilelli.net>
In-Reply-To: <001601c3d960$696a5550$0901a8c0@bloodlust>
References:  <001601c3d960$696a5550$0901a8c0@bloodlust>

next in thread | previous 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.

Maybe this little sh(1) script can do the job:

# ========================= begin.script =========================
#! /bin/sh

path=~/tmp
files="file1 file2 file3"
output_file=this.one

cd ${path} && [ ! -f ${output_file} ] && \
for file in ${files}
do
  echo ---------------------------------------- >> ${output_file}
  echo ${file} >> ${final_file}
  echo ---------------------------------------- >> ${output_file}
  cat ${file} >> ${final_file}
done
echo ---------------------------------------- >> ${output_file}
exit 0
# ========================= end.script =========================

--
-jpeg.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?50121.192.168.0.97.1073949850.squirrel>