我有一个只有 1 行的大文档,它跨越vi
.
下面是一小段摘录,我想在之后显示文本aria-label="
然后我想停在aria-selected=
这将沿着这一行重复多次,并且可能包含多个名称。
我想知道如何使用换行标记将文件分成多行aria-label=
,然后 grep 行。
后面总会有一个数字,aria-label=
这样可能有助于删除其他匹配项?
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"
答案1
尝试这个,
grep -Po '(?<=(aria-label=")).*(?=" aria-selected=)' file
aria-label="
它打印和之间的值" aria-selected=