Sponsored Content
Top Forums Shell Programming and Scripting Script to check the string in a file and print an attribute in the message Post 302997357 by suren424 on Friday 12th of May 2017 03:13:43 AM
Old 05-12-2017
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

Code:
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

Last edited by Don Cragun; 05-12-2017 at 05:23 AM.. Reason: Add CODE and ICODE tags again.
 

10 More Discussions You Might Find Interesting

1. Linux

File attribute Help please

Could anyone help i have a question that i have a problem with for my home work it is, How do i change file permissions in a command line enviromet thanx (1 Reply)
Discussion started by: Cube3k
1 Replies

2. UNIX for Dummies Questions & Answers

Script to check for a file, check for 2hrs. then quit

I wish to seach a Dir for a specific file, once the file is found i will perform additional logic. If the file is not found within two hours, i would like to exit. Logically, I'm looking for the best way to approach this Thanks for any assistance in advance. Note: I'm using a C shell and... (2 Replies)
Discussion started by: mmarsh
2 Replies

3. Shell Programming and Scripting

check for not null string in file

Hi, If, in a text file a string is expected at a certain fixed position(for eg at position 5 or from 5-10 on every line) how to check whether data is present on that position or not? Thnx in advance (6 Replies)
Discussion started by: misenkiser
6 Replies

4. Shell Programming and Scripting

bash script to check the first character in string

Hello would appreciate if somebody can post a bash script that checks if the first character of the given string is equal to, say, "a" thnx in advance (2 Replies)
Discussion started by: ole111
2 Replies

5. Shell Programming and Scripting

How to Check given string is number in shell script?

Hi, Can anyone help me out to check whether the input argument is number? Example: REQUEST_ID="123456" I need to check the REQUEST_ID value is number or string. Thanks in Advance Regards BS (6 Replies)
Discussion started by: balajiora
6 Replies

6. Shell Programming and Scripting

Linux Shell Script to check for string inside a file?

This is what I have so far grep -lir "some text" * I need to check all files on the system for this text, if the text is found I need to change the file permissions so only ROOT has read and write access. How can this be done? (3 Replies)
Discussion started by: mapleleafs89
3 Replies

7. Programming

Python: Check 2 text files for string and print contexts

I have 2 text files: cities.txt San Francisco Los Angeles Seattle Dallas master.txt Atlanta is chill and laid-back. I love Los Angeles. Coming to Dallas was the right choice. New York is so busy! San Francisco is fun. Moving to Boston soon! Go to Seattle in the summer. ... (0 Replies)
Discussion started by: pxalpine
0 Replies

8. Shell Programming and Scripting

Check file for string existence before appending it with string

I want to append file with a string but before doing that i want to check if this string already exist in that file.I tried with grep on Solaris 10 but unsuccessful.Man pages from grep seems to suggest if the string is found command status will be 0 and if not 1.But i am not finding it.May be i... (2 Replies)
Discussion started by: sahil_shine
2 Replies

9. Shell Programming and Scripting

Use while loop to read file and use ${file} for both filename input into awk and as string to print

I have files named with different prefixes. From each I want to extract the first line containing a specific string, and then print that line along with the prefix. I've tried to do this with a while loop, but instead of printing the prefix I print the first line of the file twice. Files:... (3 Replies)
Discussion started by: pathunkathunk
3 Replies

10. UNIX for Beginners Questions & Answers

awk script to match string and print status

Dear team, Need support to built awk script for below requirement Input file LOTC cluster state: ------------------- Node safNode=SC_2_1 joined cluster | Node safNode=SC_2_2 joined cluster | Node safNode=PL_2_3 fail cluster | AMF cluster state: ------------------... (16 Replies)
Discussion started by: shanul karim
16 Replies
GCHEM3D(1)						       gnome-chemistry-utils							GCHEM3D(1)

NAME
gchem3d - a small chemical viewer application SYNOPSIS
gchem3d [OPTION(S)...] [FILE...] DESCRIPTION
gchem3d is a small chemical viewer application, which can show several chemical file formats. OPTIONS
The following options are accepted: -b COLOR, --bgcolor=COLOR Use the given color as background color. COLOR can be one of "black" (default), "white", "#rrggbb" (don't forget to escape the "#" character in the shell). -d MODEL, --display3d=MODEL Choose how molecules are displayed. MODEL can be one of "BallnStick" (default), "SpaceFill". -?, --help Show application help options. --help-all, --help-* Print all or just a group of help options. These options are not documented here. Instead see gtk-options(7) and gnome-options(7). -v, --version Print gchem3d version information. SEE ALSO
gnome-options(7), gtk-options(7) AUTHORS
Jean Brefort <jean.brefort@normalesup.org> Program author. Daniel Leidert <daniel.leidert@wgdd.de> Manpage author. COPYRIGHT
Copyright (C) 2002-2007 Jean Brefort Copyright (C) 2004-2007 Daniel Leidert Permission is granted to copy, distribute and/or modify this document under the terms of the GNU General Public License, Version 2 or any later version published by the Free Software Foundation. gcu 0.12 $Date: 2009-03-19 10:53:47 +0100 (jeu. 19 mars 2009) $ GCHEM3D(1)
All times are GMT -4. The time now is 05:32 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy