#!/bin/bash
#
# Creates libdevpart[-xyz].comp by concatenating code areas from 
# devpart *.comp files
#
devpart=$1
shift

args=("$@")
outfile="${args[-1]}"
unset args[-1]

# Truncate
> $outfile

for file in "${args[@]}"; do
    awk -v repl="$devpart" -v fname="$file" '
		index($0, "<" repl ">") { 
			found = 1 
			next
		}
		found { print }
	' "$file" >> "$outfile"
done