Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
there is file contains below list of 1000 sample messages. I need to extract very specific reference.Could you please provide the command, I have tried grep it did not work.
ExceptionData>2711231382 </ExceptionData>
Could you please help out
<?xml version="1.0" encoding="UTF-8" ?><ExceptionMessage><ExceptionMessageContext><ExceptionType>MATCHING</ExceptionType><ExceptionMessageFormat>XML</ExceptionMessageFormat><ExceptionMessageDetail><![CDATA[<matchingerror><eqFiTrade><salesInformation><salesmanID><salesmanIDType></salesmanIDType><salesmanIDValue>WIB </salesmanIDValue></salesmanID></salesInformation><bookingParty><entityID>840 </entityID><accountID><accountIDType>N</accountIDType><accountIDValue>83080201 </accountIDValue></accountID></bookingParty><investAgent><investAgentIDvalue></investAgentIDvalue><accountID><accountIDType>N</accountIDType><accountIDValue></accountIDValue></accountID></investAgent><counterParty><counterPartyType>S</counterPartyType><accountID><accountIDType>S</accountIDType><accountIDValue>DB INT AG </accountIDValue></accountID></counterParty><security><identifier><identifierType>0</identifierType><identifierValue>GB0005603997</identifierValue><identifierType>S</identifierType><identifierValue>LGEN.F</identifierValue></identifier><identifier><identifierType>QUICK</identifierType><identifierValue></identifierValue></identifier><securityCcy>GBP</securityCcy><securityCcy>GBP</securityCcy></security><transaction><tradeID><tradeIDType>ESPEAR </tradeIDType><tradeIDValue>2711231382 </tradeIDValue><tradeIDVersion>1</tradeIDVersion></tradeID><tradeDate>20110810</tradeDate><valueDate>20110815</valueDate><buySell>B</buySell><securityPrice><price>0.9938</price><isAvg>N</isAvg></securityPrice><securityNetPrice><price>0</price></securityNetPrice><quantity><quantityType> </quantityType><amount>1465</amount></quantity><source><tradeID><tradeIDType>GEMSLN</tradeIDType><tradeIDValue>ESPEAR-4335318873</tradeIDValue></tradeID></source><tradeLinkage><linkageType>BASKET</linkageType><linkID>LAUG10KJW</linkID></tradeLinkage><commission></commission><tax></tax><accruedInterest></accruedInterest><priceType></priceType></transaction><settlement><payCcy>GBP</payCcy><instructions><depotAccount></depotAccount><agentBicCode></agentBicCode><agentBicName></agentBicName><externalRefNo></externalRefNo><cptyPrtcpntID></cptyPrtcpntID><reasonCodes></reasonCodes><centerReference></centerReference></instructions></settlement><valuation><payCcyNetAmount>1455.92</payCcyNetAmount></valuation><claims><eSpearParentTradeRef></eSpearParentTradeRef><underlyingSecurity></underlyingSecurity><agentSourceID></agentSourceID></claims></eqFiTrade><matching><EspearReference>2711231382 </EspearReference><Exposure>0</Exposure><clientType>Contract Match Client</clientType><contractStatus>UnMatched</contractStatus><agentStatus>UnMatched</agentStatus><proposal>Yes</proposal><key>INTRASPEARTRADE2711231382 END</key><contactNumber></contactNumber><cassitNumber>100348</cassitNumber><Domicile>DE</Domicile><contractMatchRef></contractMatchRef></matching></matchingerror>]]></ExceptionMessageDetail></ExceptionMessageContext><Exception><ExceptionID>MM003221</ExceptionID><ExceptionData>2711231382 </ExceptionData><ExceptionAction>DELETE</ExceptionAction><ExceptionPriority>HIGH</ExceptionPriority></Exception></ExceptionMessage>
more filename | grep "ExceptionData>2711231382 </ExceptionData>"
when you do this, it will show you what you are looking for. You have to use the quotes so the string does not process the special characters in the text you are searching for.
more filename | grep "ExceptionData>2711231382 </ExceptionData>"
when you do this, it will show you what you are looking for. You have to use the quotes so the string does not process the special characters in the text you are searching for.
..... in this single file, or you are looking for this information (ExceptionData>2711231382 </ExceptionData>) in 1000's of files...
sorry for the misunderstanding...
Yeah, I'm not clear on it either, but the command above will work anyway. Instead of "cat <one file name>", you can do "cat *", and it will go through ALL the files in a directory, look for that pattern, and output it to a single output file.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.