# shell command, assuming there are not tons of files in file_path: grep -h ^CQA_STATUS file_path/cqa_* > file_path/CQA_STATUS # but if there are tons of files, do it like this: find file_path -name 'cqa_*' | xargs grep -h ^CQA_STATUS > file_path/CQA_STATUS # (update: added carets where needed)