Originally Posted by tekmann33
Actually, what I mean is that I would want the file name to precede the contents of the file. This is what bunches_of_files.txt would look like:
"Contents of file1.txt"
"Contents of file2.txt"
Obviously I could do this manually, but I was wondering if there is a way to both append a file and include the title of the file with one command.
You could write a small script that takes 2 commandline parameters for the 2 files .
The added fact is that is will be a generic script so that you can use any 2 files.
# script name : addfiletext
if ( test $# != 0 )
echo " " >> $2 # add empty line to file2
echo $1 >> $2 # add file1 name to file
cat $1 >> $2 # add contents of file1 to file2
echo addfiletext: 'requires two arguments'
Off course this is just a quick and basic script , without much error checking or refinement , but you should be able to get an idea.