Script question...

Julien Gabel jpeg at thilelli.net
Mon Jan 12 15:24:16 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.

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.


More information about the freebsd-questions mailing list