Help with using awk for the file | Unix Linux Forums | Shell Programming and Scripting

  Go Back    


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

Help with using awk for the file

Shell Programming and Scripting


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 01-25-2013
aroragaurav.84 aroragaurav.84 is offline
Registered User
 
Join Date: Jun 2012
Last Activity: 6 November 2013, 4:34 PM EST
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Help with using awk for the file

INPUT FILE1:

Code:
Fri Jan 25 12:13:59 EST 2013:threadWebContainer : 624:com.travimp.hotelierlinks.abba.service.RequestHandler.requestService(String, ITICSDataSet): hotelMakeNewReservation response:  
{Header}{version=5.1}{requestType=hotelMakeNewReservation}{resultCode=1}{sessionID=285076295965823743626150999413479632915}
  {Error}{errorCode=9002}{errorMessage=The transaction failed with link HBS_SANDALS. It returned the following error instead of the normal expected response. Failed! Please report.}

Fri Jan 25 12:18:15 EST 2013:threadThread-174156:com.travimp.hotelierlinks.abba.service.CommunicationHandler$CommunicateWithExternalLinkService.run(): Received message from [https://www.demandmatrix.net/app/
dm/xml] in [2011] milliseconds.
Fri Jan 25 12:18:15 EST 2013:threadWebContainer : 588:com.travimp.hotelierlinks.abba.service.RequestHandler.requestService(String, ITICSDataSet): hotelMakeNewReservation response:  
{Header}{version=5.1}{requestType=hotelMakeNewReservation}{resultCode=0}{sessionID=66250060096521179319873899081858860792}
  {Confirmation}{totalNetPrice=69062}{totalSellPrice=69062}{roomOfferID=169810864490756661075630431568511157029}{roomPrice=69062}{svcChargeIncluded=false}{linkConfID=CysuoWm}{currencyCode=USD}{linkVersion=0}

Fri Jan 25 12:13:59 EST 2013:threadWebContainer : 624:com.travimp.hotelierlinks.abba.service.RequestHandler.requestService(String, ITICSDataSet): hotelMakeNewReservation response:  
{Header}{version=5.1}{requestType=hotelMakeNewReservation}{resultCode=1}{sessionID=285076295965823743626150999413479632915}
  {Error}{errorCode=1008}{errorMessage=The transaction failed with link HBS_SANDALS. It returned the following error instead of the normal expected response. Failed! Please report.}

Fri Jan 25 12:13:59 EST 2013:threadWebContainer : 624:com.travimp.hotelierlinks.abba.service.RequestHandler.requestService(String, ITICSDataSet): hotelMakeNewReservation response:  
{Header}{version=5.1}{requestType=hotelMakeNewReservation}{resultCode=1}{sessionID=285076295965823743626150999413479632915}
  {Error}{errorCode=2674}{errorMessage=The transaction failed with link HBS_SANDALS. It returned the following error instead of the normal expected response. Failed! Please report.}

IN INPUT FILE1 need to grep "errorCode=" and increment the counter each time in file "errorCode=" occurs and send an email when counter reaches the max value 10. then again reset the counter to 0(zero) and start again.
Sponsored Links
    #2  
Old 01-25-2013
tukuyomi tukuyomi is offline
Registered User
 
Join Date: Aug 2009
Last Activity: 24 April 2014, 5:42 PM EDT
Location: France
Posts: 317
Thanks: 17
Thanked 80 Times in 75 Posts
What about grep -c ?
Sponsored Links
    #3  
Old 01-25-2013
Yoda's Avatar
Yoda Yoda is offline Forum Advisor  
Jedi Master
 
Join Date: Jan 2012
Last Activity: 24 April 2014, 6:15 PM EDT
Location: Galactic Empire
Posts: 3,285
Thanks: 227
Thanked 1,158 Times in 1,095 Posts

Code:
awk '/errorCode=/{++c}c==10{print "Email Body" | "mail -s \"Subject\" user@domain.com"; c=0;}' inputfile

Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
awk command to compare a file with set of files in a directory using 'awk' anandek Shell Programming and Scripting 10 05-30-2012 09:21 AM
Split File by Pattern with File Names in Source File... Awk? cul8er Shell Programming and Scripting 2 11-25-2011 01:38 PM
write awk command into file using awk gc_sw Shell Programming and Scripting 6 11-10-2010 10:43 AM
Parse file using awk and work in awk output dagigg Shell Programming and Scripting 6 02-13-2010 02:48 PM



All times are GMT -4. The time now is 07:38 PM.