Script to check the string in a file and print an attribute in the message

Hi,

I am new to shell scripting and got a task to complete.

Task is : we have a log file where in i need to traverse through the whole file to check the string " Person Type missing in message " and after that i need to get EMPLID=xxxxxx from the file and print details in a different file.

Below is snippet of the message in log file ( highlighted in color) which i need from the file

2017-05-09 20:15:51,713 [asyncDelivery111] [ConnectorBean] [] - ConnectorBean/findEventType Attention ::TEAM
The message with Message IDID:414d5120455342459080862020202020632eee58ffe83028is being ignored::For create event type, Person Type missing in messageFind user attributes in next line
{BUSINESS_TITLE=, PER_TYPE=, PayGroupCode=, LaborType=, RehireDate=, WORKSHIFT_CD=, POSITION_NBR=, HRServiceDate=2017-05-30, FIRST_NAME=xxxx, PeopleSoftID=, HOME_EMAIL_ADDRESS=, JOB_DESCRIPTION=, PER_STATUS=, FAX=, HOME_PHONE=, COMPANY=, WORK_PHONE=, Work Address Line One=, Country=, LAST_NAME=xxxx, PREF_MIDDLE_NAME=, StatusReason=GENERAL_EVENT_SUBCATEGORY-6-66, MANAGER_ID=, DIVISION=, WorkerTypeName=, PREF_FIRST_NAME=xxx, TMS_DEPT_GRP=, EMPL_CLASS=, MAIL_DROP=, DEPTID=, MatrixManager=, COMPANY_DESCR=, EMAIL_ADDR=, DEPT_DESCR=, DEPT_GROUP_ID=, PREF_LAST_NAME=xxxx, WorkerTypeCode=Team Member, UNION_CD=, BUSINESSCELL=, HRSeniorityDate=2017-05-22, PREF_SUFFIX_NAME=, DIVISION_DESCR=, SOX_TRANSFER_FLAG=N, Zip Code=, JOBCODE=, BadgeID=, GRADE=, EMPL_STATUS=A, NAME_SUFFIX=, Work Addrress Line Two=, City=, LOCATION=, LOCATION_DESCR=, JobLevel=, State=, MOBILE=, MIDDLE_NAME=, EMPLID=000112, TMS_PAGER=, REGION_CODE=}

Please let me know, how can i accomplish this.

Thanks in advance

Please:

  1. use CODE tags when displaying sample input, sample output, and code segments so we can tell how many lines are in your sample data, see whether or not there are multiple adjacent whitespace characters, and (when there are multiple column positions occupied by whitespace characters) determine whether those characters are tabs or multiple spaces,
  2. tell us what operating system you're using,
  3. what shell you're using,
  4. explain the format of your input data (Are there always three lines per record in your input file? Is the 1st string you're looking for always on the 2nd line in a record? Is the 2nd string you're looking for always in the same comma separated field on the 3rd line in a record? Is there only one record in each log file? What is/are the name(s) of your log file(s)?),
  5. explain the format of the output you want to produce,
  6. show us the output (exactly) you hope to produce from your sample input file (in code tags),
  7. tell us the name of the output file you hope to produce,
  8. and show us what you have tried to solve this problem on your own.