single long line searching2019 Community Moderator Electionawk one single lineString pattern searchingSearching out a pattern from LogsConvert multilines to single lineGrep on single linegrep syntax for searching strings with single-quotes?Searching for only single words in UnixUsing 'find' then searching each line for two values in bash scriptsearching letters in one line using grep and wcgrep stringset as a single line
Integral Notations in Quantum Mechanics
Should I warn new/prospective PhD Student that supervisor is terrible?
Giving feedback to someone without sounding prejudiced
Why does the Persian emissary display a string of crowned skulls?
Pre-Employment Background Check With Consent For Future Checks
Grepping string, but include all non-blank lines following each grep match
Check if object is null and return null
Unable to disable Microsoft Store in domain environment
Does Doodling or Improvising on the Piano Have Any Benefits?
Usage of an old photo with expired copyright
Anime with legendary swords made from talismans and a man who could change them with a shattered body
Is there a reason to prefer HFS+ over APFS for disk images in High Sierra and/or Mojave?
Why is the principal energy of an electron lower for excited electrons in a higher energy state?
What should be the ideal length of sentences in a blog post for ease of reading?
El Dorado Word Puzzle II: Videogame Edition
How to reduce predictors the right way for a logistic regression model
How do I prevent inappropriate ads from appearing in my game?
Why do Radio Buttons not fill the entire outer circle?
Do people actually use the word "kaputt" in conversation?
Why is participating in the European Parliamentary elections used as a threat?
Given this phrasing in the lease, when should I pay my rent?
Isometric embedding of a genus g surface
How to make money from a browser who sees 5 seconds into the future of any web page?
PTIJ: Which Dr. Seuss books should one obtain?
single long line searching
2019 Community Moderator Electionawk one single lineString pattern searchingSearching out a pattern from LogsConvert multilines to single lineGrep on single linegrep syntax for searching strings with single-quotes?Searching for only single words in UnixUsing 'find' then searching each line for two values in bash scriptsearching letters in one line using grep and wcgrep stringset as a single line
I have a large document that is only 1 line, it spans multiple pages of vi
.
Below is an extract of a small bit, I'm seeking to show text after aria-label="
I would then like to stop at aria-selected=
This would repeat many times along that single line and might contain more than one name.
Anyone able to assist with this - I wondered about breaking the file up in to multiple lines with aria-label=
as the line break marker and then grepping the lines.
There is always going to be a number after the aria-label=
so that might help remove other matches?
style="background-color: #0B8043;"></div>Spike Bird</div></div></div></div></div></div></div></div></div><div role="rowgroup"><div role="row"><div id="docs-revisions-sidebar-date-group-1551364837014" class="docs-revisions-sidebar-date-group" role="heading">February</div></div><div class="docs-revisions-collapsible-pane" role="presentation"><div class="docs-revisions-collapsible-pane-milestone-tile-container" role="presentation"><div class="docs-revisions-tile" role="row" aria-level="1" aria-expanded="false" id=":oj" aria-label="28 February, 14:40 Joe Bloggs" aria-selected="false"><div class="docs-revisions-tile-content-wrapper" role="presentation"><div class="docs-revisions-tile-header" role="gridcell"><div class="docs-revisions-icon docs-revisions-tile-arrow-button" data-tooltip="Expand detailed versions" aria-label="Expand detailed versions" data-tooltip-offset="-3" data-tooltip-unhoverable="true" role="button" aria-expanded="false" style="user-select: none;"><div class="docs-revisions-icon-img-mask"><div class="docs-revisions-icon-img docs-revisions-icon-arrow"></div></div></div><textarea class="docs-revisions-tile-text-box docs-revisions-tile-text-box-disabled" id=":og" spellcheck="false" rows="1" maxlength="80"
awk grep
add a comment |
I have a large document that is only 1 line, it spans multiple pages of vi
.
Below is an extract of a small bit, I'm seeking to show text after aria-label="
I would then like to stop at aria-selected=
This would repeat many times along that single line and might contain more than one name.
Anyone able to assist with this - I wondered about breaking the file up in to multiple lines with aria-label=
as the line break marker and then grepping the lines.
There is always going to be a number after the aria-label=
so that might help remove other matches?
style="background-color: #0B8043;"></div>Spike Bird</div></div></div></div></div></div></div></div></div><div role="rowgroup"><div role="row"><div id="docs-revisions-sidebar-date-group-1551364837014" class="docs-revisions-sidebar-date-group" role="heading">February</div></div><div class="docs-revisions-collapsible-pane" role="presentation"><div class="docs-revisions-collapsible-pane-milestone-tile-container" role="presentation"><div class="docs-revisions-tile" role="row" aria-level="1" aria-expanded="false" id=":oj" aria-label="28 February, 14:40 Joe Bloggs" aria-selected="false"><div class="docs-revisions-tile-content-wrapper" role="presentation"><div class="docs-revisions-tile-header" role="gridcell"><div class="docs-revisions-icon docs-revisions-tile-arrow-button" data-tooltip="Expand detailed versions" aria-label="Expand detailed versions" data-tooltip-offset="-3" data-tooltip-unhoverable="true" role="button" aria-expanded="false" style="user-select: none;"><div class="docs-revisions-icon-img-mask"><div class="docs-revisions-icon-img docs-revisions-icon-arrow"></div></div></div><textarea class="docs-revisions-tile-text-box docs-revisions-tile-text-box-disabled" id=":og" spellcheck="false" rows="1" maxlength="80"
awk grep
2
Is the document a well formed XML document?
– Kusalananda
20 hours ago
add a comment |
I have a large document that is only 1 line, it spans multiple pages of vi
.
Below is an extract of a small bit, I'm seeking to show text after aria-label="
I would then like to stop at aria-selected=
This would repeat many times along that single line and might contain more than one name.
Anyone able to assist with this - I wondered about breaking the file up in to multiple lines with aria-label=
as the line break marker and then grepping the lines.
There is always going to be a number after the aria-label=
so that might help remove other matches?
style="background-color: #0B8043;"></div>Spike Bird</div></div></div></div></div></div></div></div></div><div role="rowgroup"><div role="row"><div id="docs-revisions-sidebar-date-group-1551364837014" class="docs-revisions-sidebar-date-group" role="heading">February</div></div><div class="docs-revisions-collapsible-pane" role="presentation"><div class="docs-revisions-collapsible-pane-milestone-tile-container" role="presentation"><div class="docs-revisions-tile" role="row" aria-level="1" aria-expanded="false" id=":oj" aria-label="28 February, 14:40 Joe Bloggs" aria-selected="false"><div class="docs-revisions-tile-content-wrapper" role="presentation"><div class="docs-revisions-tile-header" role="gridcell"><div class="docs-revisions-icon docs-revisions-tile-arrow-button" data-tooltip="Expand detailed versions" aria-label="Expand detailed versions" data-tooltip-offset="-3" data-tooltip-unhoverable="true" role="button" aria-expanded="false" style="user-select: none;"><div class="docs-revisions-icon-img-mask"><div class="docs-revisions-icon-img docs-revisions-icon-arrow"></div></div></div><textarea class="docs-revisions-tile-text-box docs-revisions-tile-text-box-disabled" id=":og" spellcheck="false" rows="1" maxlength="80"
awk grep
I have a large document that is only 1 line, it spans multiple pages of vi
.
Below is an extract of a small bit, I'm seeking to show text after aria-label="
I would then like to stop at aria-selected=
This would repeat many times along that single line and might contain more than one name.
Anyone able to assist with this - I wondered about breaking the file up in to multiple lines with aria-label=
as the line break marker and then grepping the lines.
There is always going to be a number after the aria-label=
so that might help remove other matches?
style="background-color: #0B8043;"></div>Spike Bird</div></div></div></div></div></div></div></div></div><div role="rowgroup"><div role="row"><div id="docs-revisions-sidebar-date-group-1551364837014" class="docs-revisions-sidebar-date-group" role="heading">February</div></div><div class="docs-revisions-collapsible-pane" role="presentation"><div class="docs-revisions-collapsible-pane-milestone-tile-container" role="presentation"><div class="docs-revisions-tile" role="row" aria-level="1" aria-expanded="false" id=":oj" aria-label="28 February, 14:40 Joe Bloggs" aria-selected="false"><div class="docs-revisions-tile-content-wrapper" role="presentation"><div class="docs-revisions-tile-header" role="gridcell"><div class="docs-revisions-icon docs-revisions-tile-arrow-button" data-tooltip="Expand detailed versions" aria-label="Expand detailed versions" data-tooltip-offset="-3" data-tooltip-unhoverable="true" role="button" aria-expanded="false" style="user-select: none;"><div class="docs-revisions-icon-img-mask"><div class="docs-revisions-icon-img docs-revisions-icon-arrow"></div></div></div><textarea class="docs-revisions-tile-text-box docs-revisions-tile-text-box-disabled" id=":og" spellcheck="false" rows="1" maxlength="80"
awk grep
awk grep
edited 18 hours ago
Rui F Ribeiro
41.6k1483141
41.6k1483141
asked 20 hours ago
Terry Bradford StaffTerry Bradford Staff
1
1
2
Is the document a well formed XML document?
– Kusalananda
20 hours ago
add a comment |
2
Is the document a well formed XML document?
– Kusalananda
20 hours ago
2
2
Is the document a well formed XML document?
– Kusalananda
20 hours ago
Is the document a well formed XML document?
– Kusalananda
20 hours ago
add a comment |
2 Answers
2
active
oldest
votes
Try this,
grep -Po '(?<=(aria-label=")).*(?=" aria-selected=)' file
it prints the value between aria-label="
and " aria-selected=
add a comment |
I know that OP asked for either awk
or grep
based answers. Also @msp9011 's answer with its Perl regex is perfectly correct. As a reference, here is the sed
version for all it's worth:
$ sed 's/^.*aria-label="(.*)" aria-selected=.*$/1/g' filename
It also prints the valueS between aria-label="
and " aria-selected=
including when there is more than one occurrence of the regex on one line.
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f507387%2fsingle-long-line-searching%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Try this,
grep -Po '(?<=(aria-label=")).*(?=" aria-selected=)' file
it prints the value between aria-label="
and " aria-selected=
add a comment |
Try this,
grep -Po '(?<=(aria-label=")).*(?=" aria-selected=)' file
it prints the value between aria-label="
and " aria-selected=
add a comment |
Try this,
grep -Po '(?<=(aria-label=")).*(?=" aria-selected=)' file
it prints the value between aria-label="
and " aria-selected=
Try this,
grep -Po '(?<=(aria-label=")).*(?=" aria-selected=)' file
it prints the value between aria-label="
and " aria-selected=
edited 19 hours ago
answered 20 hours ago
msp9011msp9011
4,44344167
4,44344167
add a comment |
add a comment |
I know that OP asked for either awk
or grep
based answers. Also @msp9011 's answer with its Perl regex is perfectly correct. As a reference, here is the sed
version for all it's worth:
$ sed 's/^.*aria-label="(.*)" aria-selected=.*$/1/g' filename
It also prints the valueS between aria-label="
and " aria-selected=
including when there is more than one occurrence of the regex on one line.
add a comment |
I know that OP asked for either awk
or grep
based answers. Also @msp9011 's answer with its Perl regex is perfectly correct. As a reference, here is the sed
version for all it's worth:
$ sed 's/^.*aria-label="(.*)" aria-selected=.*$/1/g' filename
It also prints the valueS between aria-label="
and " aria-selected=
including when there is more than one occurrence of the regex on one line.
add a comment |
I know that OP asked for either awk
or grep
based answers. Also @msp9011 's answer with its Perl regex is perfectly correct. As a reference, here is the sed
version for all it's worth:
$ sed 's/^.*aria-label="(.*)" aria-selected=.*$/1/g' filename
It also prints the valueS between aria-label="
and " aria-selected=
including when there is more than one occurrence of the regex on one line.
I know that OP asked for either awk
or grep
based answers. Also @msp9011 's answer with its Perl regex is perfectly correct. As a reference, here is the sed
version for all it's worth:
$ sed 's/^.*aria-label="(.*)" aria-selected=.*$/1/g' filename
It also prints the valueS between aria-label="
and " aria-selected=
including when there is more than one occurrence of the regex on one line.
answered 8 hours ago
CbhiheCbhihe
3971518
3971518
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f507387%2fsingle-long-line-searching%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
2
Is the document a well formed XML document?
– Kusalananda
20 hours ago