Comparing one file header with another file header

Hi Experts,

In our project we have requirement where in we have to compare header of one file with header in the parameter file.
There are 20 files which we ftp from one site. All this files have different header.
We are comapring this file with our parameter file(which is having the header fields in the format what we are expecting) :o
If the ftp file header format matches with the parameter file format then we are processing these file, if not we are renaming it Unprocess_file.

The parameter file structure is :

FileName|Daily_Process|Expected_Header|TABLE_NAME
acct_details.csv|Y|ACCT_NBR,UserName,Status,Date|ACCT_DETAILS
address_info.csv|Y|ACCT_NBR,ADD_DETAILS,STATE,ZIP|ADDRESS_INFO

Now the problem is the one the of the source file header is coming as :

ACCT_NBR, ADD_DETAILS, STATE, ZIP

That is it has got spaces in between the column names.
How can i compare these file with existing parameter file. If i change the parameter file (that is added space in between the columns ) still its not working. :confused:

How can I handle this scenario? :eek:

Thanks in Advance!!

 
h=$( sed '
  s/, */,/g
  q
 ' $data_file )
 
emsg=
 
for f in $( sed '
  /^'"$file_type"'|/!d
  s/.*|\(.*\)|.*/\1/
  s/, */ /g
 ' $parm_file )
do
 if [ "$f" != "${h%%,*}" ]
 then
  emsg="$emsg, $f is ${h%%,*}"
 fi
 h=${h#*,}
done
 
if [ "$emsg" != "" ]
then
 echo "File error$emsg." >&2
 mv $data_file Unprocess_file.$data_file
fi

Thanks for the immediate reply!!
Its working !!:smiley: