Grep 2 same strings in a same line??

I have this code

 TrackingId:1362412470675;MSISDN:; INFO  [ResponseQueueDispatcher.run:32] - [] number of clietns:3:Received response is: EMSResponse [responseType=NOTIFICATION, serviceId=idBamboo, additionalParameters={NOTIFICATION_TYPE=BAMBOO, IS_CHERRY=1, opid=IDEA, DEVICE_PLATFORM=S30}, confirmedPurchaseResponse=null, msgid=ISRN, preparePurchaseResponse=null, processingResult=ProcessingResult [errorMessage=null, success=true, processResponse=null, errorMessageResource=null], protocolVersion=5, purchaseOptions=null, serviceData=ServiceData [messageId=ufbsE12v, screens=[Screen [actions=[], screenData=CanvasData [canvasComponents=[CanvasComponent [content=null, type=TEXT, markers={}, contentLangCode=en , contentResource=MessageResource[text=null, textId=bamboo_msg, placeholders=null, resolvable=true, textLangCode=en]]], title=null, titleResource=MessageResource[text=null, textId=bamboo_msg_title, placeholders=null, resolvable=true, textLangCode=en]], screenType=null]], serviceId=idBamboo, serviceStatus=STATUS_GET_ONCE, variables=[]], sourceMsisdn=null, targetInbox=NLT_INBOX, destinations=[Destination [deviceId=03551890591, mints=918958266637, transactionId=1362412, clientSoftwareVersion=5], Destination [deviceId=0355212052568245, mints=918347032859, transactionId=1362412469578, clientSoftwareVersion=5], Destination [deviceId=0355503058037783, mints=9186083, transactionId=1362412469853, c

[/CODE]

I'm always getting the word mints in d same line for more than 1 time.

when i'm trying to grep , m not gettin d 2nd mints in d same line....

Actually m trying to get number after mints...

---------- Post updated at 04:12 PM ---------- Previous update was at 03:58 PM ----------

m looking for the 12 digit number after every mints in d line..

Pls post , sample output you are expecting from the input.

awk -F, 'NR>1 {print "mints="$1}' RS="mints=" infile
mints=918958266637
mints=918347032859
mints=9186083

You don't say anything on how you like the output.

awk -F, 'NR>1 {printf "%s,",$1} END {print ""} ' RS="mints="
918958266637,918347032859,9186083,

Perl:

perl -lane 'while (m/\bmints=(\d+)/g){print $1}' infile

i got it

grep -o "mints=............" filename

thank you all of you :slight_smile:

Not optimal. This may give

mints=53653465
mints=544, trans
mints=45454, tra
grep -o "mints=[0-9][0-9]*,"  file_name
grep -o "mints=[0-9][0-9]*,"

, may be removed, or else it would be printed.

Other solution

grep -oE "mints=[0-9]+" filename