I would like a shell script that reads all files in a directory and concatenate them. It is not a simple concatenation. The first few lines of the files should not be included. The lines to be included are the lines from where 'START HERE' appears up to the end of the file. For example, I have 3 files:
File 1:
abc
def
START HERE
line1
line2
File 2:
xyz
efg
START HERE
line111
line222
File 3:
jkl
mno
START HERE
line11
line22
The resulting file should be:
START HERE
line1
line2
START HERE
line111
line222
START HERE
line11
line22
Thanks Franklin, but the number of files and the filenames may vary. It should be dynamic that it will process all files in the directory... Please modify..
Thanks much! That works! I got a new requirement today in addition to that. I have to attach a header to it. I have a file header whose contents (which may vary) I need to prefix to the concatenation. For example:
FileHeader:
FILES AS OF TODAY:
HEADER LINE1
HEADER LINE2
And the result should be:
FILES AS OF TODAY:
HEADER LINE1
HEADER LINE2
START HERE
line1
line2
START HERE
line111
line222
START HERE
line11
line22