How to grep data of a new line when capturing a keywordfind first line beginning with <keyword>...

Should I take up a Creative Writing online course?

What do the screens say after you are set free?

Can I say "Gesundheit" if someone is coughing?

How to draw twisted cuves?

Being told my "network" isn't PCI compliant. I don't even have a server! Do I have to comply?

speaker impedence

Basic theorem proving in Mathematica?

How does Rust's 128-bit integer `i128` work on a 64-bit system?

Word to describe someone doing something even though told not to

How long should I wait to plug in my refrigerator after unplugging it?

How to trick a fairly simplistic kill-counter?

How can a class have multiple methods without breaking the single responsibility principle

Password management for kids - what's a good way to start?

"Fewer errors means better products" or "Fewer errors mean better products"?

Does the use of a new concept require a prior definition?

The grades of the students in a class

If a Shadow Magic sorcerer casts Darkness using the Eyes of the Dark feature, can they cast another spell that requires concentration?

Can Otiluke's Freezing Spheres be stockpiled?

How is Sword Coast North governed?

Partial Fractions: Why does this shortcut method work?

Map vs. Table for index-specific operations on 2D arrays

How do I respond appropriately to an overseas company that obtained a visa for me without hiring me?

Why did the United States not resort to nuclear weapons in Vietnam?

How do I safety check that there is no light in Darkroom / Darkbag?



How to grep data of a new line when capturing a keyword


find first line beginning with <keyword> following <other-keyword>grep - recognize carriage return as new linePrinting a new line using awkHow to grep whitespace exclude new-line character?Extract keyword from lineExtracting a specific data from a file using keyword [awk]grep data and add it at the end of a linehow to get data from grep result?awk or grep? - print keyword and following columnsGrep data in specific pattern






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







0















I have a file which contains below sample line having a common keyword P00001121 in each line.



[H00,P00001121] CHANNEL__OPEN:TCP_ADDRESS='10.32.130.202' TCP_PORT='80'"
[H00,P00001121] COMMS_QUEUING:RECV='01/08/2019 14:33:45.064410' QUEUE_TIME='00000.000' TO_DEV='
[H00,P00001121] FROM_EXCHANGE:HTTP/1.1 200 OKrn
Server: Apache-Coyote/1.1rn
Content-Type: text/xml;charset=UTF-8rn
Content-Length: 878rn
Date: Thu, 01 Aug 2019 04:33:45 GMTrn
rn

[H00,P00001121] CONTEXT=PARAMETER : CLIENTID =>
[H00,P00001121] CONTEXT=PARAMETER : TRANSACTIONID => 20190801143344970"
[H00,P00001121] CONTEXT=PARAMETER : KEY_TYPE => SERVICEID
[H00,P00001121] CONTEXT=PARAMETER : ORDERSOURCESYSTEM =>



I want to capture all the line of the keyword (P00001121) and also the following few lines below keyword which has rn in it (there may be 1 line with rn or 10 lines with rn in the following lines). Now all the lines in the file having keyword has those following line with rn in it. I am ok to use any command, be it grep, awk, cut etc whichever works... .



[Server: Apache-Coyote/1.1rn



Content-Type: text/xml;charset=UTF-8rn



Content-Length: 878rn



Date: Thu, 01 Aug 2019 04:33:45 GMTrn



rn



]










share|improve this question







New contributor



Satya is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






















  • Please post the sample output as text delimited text (separated as new lines ) as the one you have given is not line delimited and is being read as one long line. However in the meantime I will provide an answer by delimiting the one you have given and it should get you going.

    – BarBar1234
    12 mins ago


















0















I have a file which contains below sample line having a common keyword P00001121 in each line.



[H00,P00001121] CHANNEL__OPEN:TCP_ADDRESS='10.32.130.202' TCP_PORT='80'"
[H00,P00001121] COMMS_QUEUING:RECV='01/08/2019 14:33:45.064410' QUEUE_TIME='00000.000' TO_DEV='
[H00,P00001121] FROM_EXCHANGE:HTTP/1.1 200 OKrn
Server: Apache-Coyote/1.1rn
Content-Type: text/xml;charset=UTF-8rn
Content-Length: 878rn
Date: Thu, 01 Aug 2019 04:33:45 GMTrn
rn

[H00,P00001121] CONTEXT=PARAMETER : CLIENTID =>
[H00,P00001121] CONTEXT=PARAMETER : TRANSACTIONID => 20190801143344970"
[H00,P00001121] CONTEXT=PARAMETER : KEY_TYPE => SERVICEID
[H00,P00001121] CONTEXT=PARAMETER : ORDERSOURCESYSTEM =>



I want to capture all the line of the keyword (P00001121) and also the following few lines below keyword which has rn in it (there may be 1 line with rn or 10 lines with rn in the following lines). Now all the lines in the file having keyword has those following line with rn in it. I am ok to use any command, be it grep, awk, cut etc whichever works... .



[Server: Apache-Coyote/1.1rn



Content-Type: text/xml;charset=UTF-8rn



Content-Length: 878rn



Date: Thu, 01 Aug 2019 04:33:45 GMTrn



rn



]










share|improve this question







New contributor



Satya is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






















  • Please post the sample output as text delimited text (separated as new lines ) as the one you have given is not line delimited and is being read as one long line. However in the meantime I will provide an answer by delimiting the one you have given and it should get you going.

    – BarBar1234
    12 mins ago














0












0








0








I have a file which contains below sample line having a common keyword P00001121 in each line.



[H00,P00001121] CHANNEL__OPEN:TCP_ADDRESS='10.32.130.202' TCP_PORT='80'"
[H00,P00001121] COMMS_QUEUING:RECV='01/08/2019 14:33:45.064410' QUEUE_TIME='00000.000' TO_DEV='
[H00,P00001121] FROM_EXCHANGE:HTTP/1.1 200 OKrn
Server: Apache-Coyote/1.1rn
Content-Type: text/xml;charset=UTF-8rn
Content-Length: 878rn
Date: Thu, 01 Aug 2019 04:33:45 GMTrn
rn

[H00,P00001121] CONTEXT=PARAMETER : CLIENTID =>
[H00,P00001121] CONTEXT=PARAMETER : TRANSACTIONID => 20190801143344970"
[H00,P00001121] CONTEXT=PARAMETER : KEY_TYPE => SERVICEID
[H00,P00001121] CONTEXT=PARAMETER : ORDERSOURCESYSTEM =>



I want to capture all the line of the keyword (P00001121) and also the following few lines below keyword which has rn in it (there may be 1 line with rn or 10 lines with rn in the following lines). Now all the lines in the file having keyword has those following line with rn in it. I am ok to use any command, be it grep, awk, cut etc whichever works... .



[Server: Apache-Coyote/1.1rn



Content-Type: text/xml;charset=UTF-8rn



Content-Length: 878rn



Date: Thu, 01 Aug 2019 04:33:45 GMTrn



rn



]










share|improve this question







New contributor



Satya is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











I have a file which contains below sample line having a common keyword P00001121 in each line.



[H00,P00001121] CHANNEL__OPEN:TCP_ADDRESS='10.32.130.202' TCP_PORT='80'"
[H00,P00001121] COMMS_QUEUING:RECV='01/08/2019 14:33:45.064410' QUEUE_TIME='00000.000' TO_DEV='
[H00,P00001121] FROM_EXCHANGE:HTTP/1.1 200 OKrn
Server: Apache-Coyote/1.1rn
Content-Type: text/xml;charset=UTF-8rn
Content-Length: 878rn
Date: Thu, 01 Aug 2019 04:33:45 GMTrn
rn

[H00,P00001121] CONTEXT=PARAMETER : CLIENTID =>
[H00,P00001121] CONTEXT=PARAMETER : TRANSACTIONID => 20190801143344970"
[H00,P00001121] CONTEXT=PARAMETER : KEY_TYPE => SERVICEID
[H00,P00001121] CONTEXT=PARAMETER : ORDERSOURCESYSTEM =>



I want to capture all the line of the keyword (P00001121) and also the following few lines below keyword which has rn in it (there may be 1 line with rn or 10 lines with rn in the following lines). Now all the lines in the file having keyword has those following line with rn in it. I am ok to use any command, be it grep, awk, cut etc whichever works... .



[Server: Apache-Coyote/1.1rn



Content-Type: text/xml;charset=UTF-8rn



Content-Length: 878rn



Date: Thu, 01 Aug 2019 04:33:45 GMTrn



rn



]







shell-script awk grep scripting






share|improve this question







New contributor



Satya is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.










share|improve this question







New contributor



Satya is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.








share|improve this question




share|improve this question






New contributor



Satya is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.








asked 44 mins ago









SatyaSatya

1




1




New contributor



Satya is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




New contributor




Satya is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.


















  • Please post the sample output as text delimited text (separated as new lines ) as the one you have given is not line delimited and is being read as one long line. However in the meantime I will provide an answer by delimiting the one you have given and it should get you going.

    – BarBar1234
    12 mins ago



















  • Please post the sample output as text delimited text (separated as new lines ) as the one you have given is not line delimited and is being read as one long line. However in the meantime I will provide an answer by delimiting the one you have given and it should get you going.

    – BarBar1234
    12 mins ago

















Please post the sample output as text delimited text (separated as new lines ) as the one you have given is not line delimited and is being read as one long line. However in the meantime I will provide an answer by delimiting the one you have given and it should get you going.

– BarBar1234
12 mins ago





Please post the sample output as text delimited text (separated as new lines ) as the one you have given is not line delimited and is being read as one long line. However in the meantime I will provide an answer by delimiting the one you have given and it should get you going.

– BarBar1234
12 mins ago










0






active

oldest

votes














Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});






Satya is a new contributor. Be nice, and check out our Code of Conduct.










draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f533773%2fhow-to-grep-data-of-a-new-line-when-capturing-a-keyword%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes








Satya is a new contributor. Be nice, and check out our Code of Conduct.










draft saved

draft discarded


















Satya is a new contributor. Be nice, and check out our Code of Conduct.













Satya is a new contributor. Be nice, and check out our Code of Conduct.












Satya is a new contributor. Be nice, and check out our Code of Conduct.
















Thanks for contributing an answer to Unix & Linux Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f533773%2fhow-to-grep-data-of-a-new-line-when-capturing-a-keyword%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Taj Mahal Inhaltsverzeichnis Aufbau | Geschichte | 350-Jahr-Feier | Heutige Bedeutung | Siehe auch |...

Baia Sprie Cuprins Etimologie | Istorie | Demografie | Politică și administrație | Arii naturale...

Nicolae Petrescu-Găină Cuprins Biografie | Opera | In memoriam | Varia | Controverse, incertitudini...