1

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.

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"  
  • 2
    Is the document a well formed XML document? – Kusalananda Mar 20 at 10:13
1

Try this,

grep -Po '(?<=(aria-label=")).*(?=" aria-selected=)' file

it prints the value between aria-label=" and " aria-selected=

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.