I have 3 files at a directory $FILES_DIR
1) File_Apple.txt
2) File_Samsung.txt
3) File_Huwaei.txt
Header rows of File_Apple.txt
AAA1,BBB2,CCC3
Header rows of File_Samsung.txt
DDD1,EEE2
Header rows of File_Huwaei.txt
FFF1,GGG2,HHH3,III4
There's another file called head_config which contains the header line of the above 3 files.
head_config.txt
AAA1,BBB2,CCC3
DDD1,EEE2
FFF1,GGG2,HHH3,III4
Basically i have to match if the headers of the file are correct as per the head_config.txt file
I am able to do so by some cumbersome process: copying header rows of each file individually and appending to a new file. Then comparing new file created with head.config.txt
head -1 File_Apple.txt >> new_file.txt
head -1 File_Samsung.txt >> new_file.txt
head -1 File_Huwaei.txt >> new_file.txt
Then cmp new_file.txt to head_config.txt
How can i do it more efficiently?