おもちゃの質問:
$ echo "foo <a href="/topic/null-hypothesis/" data-sc="text link:topic link">Null hypothesis</a> bar" | sed -E 's@.*<a href=/topic/[^>]*>([^<]*)</a>.*@\1@'
Null hypothesis
実際の世界(sedは何もフィルタリングしません):
$ cat *html | grep '<a href="/topic' | sed -E 's@.*<a href=/topic/[^>]*>([^<]*)</a>.*@\1@'
<a href="/topic/null-hypothesis/" data-sc="text link:topic link">Null hypothesis</a>,
<a href="/topic/approximation/" data-sc="text link:topic link">Approximation</a>,
<a href="/topic/estimation-methods/" data-sc="text link:topic link">Estimation methods</a>,
<a href="/topic/statistical-variance/" data-sc="text link:topic link">Statistical variance</a>,
<a href="/topic/identifiability/" data-sc="text link:topic link">Identifiability</a>,
<a href="/topic/preliminary-estimates/" data-sc="text link:topic link">Preliminary estimates</a>,
<a href="/topic/matrix-inversion/" data-sc="text link:topic link">Matrix inversion</a>
「帰無仮説」に達するにはどのような変更が必要ですか?
添付:
$ cat *html | grep -n10 '<a href="/topic' | sed -E 's@.*<a href=/topic/[^>]*>([^<]*)</a>.*@\1@'
538-
539-
540-
541-
542-
543-
544- <div class="topics-list mtl">
545- <p class="hide">You can always find the topics here!</p>
546- <strong>Topics:</strong>
547-
548: <a href="/topic/null-hypothesis/" data-sc="text link:topic link">Null hypothesis</a>,
549-
550: <a href="/topic/approximation/" data-sc="text link:topic link">Approximation</a>,
551-
552: <a href="/topic/estimation-methods/" data-sc="text link:topic link">Estimation methods</a>,
553-
554: <a href="/topic/statistical-variance/" data-sc="text link:topic link">Statistical variance</a>,
555-
556: <a href="/topic/identifiability/" data-sc="text link:topic link">Identifiability</a>,
557-
558: <a href="/topic/preliminary-estimates/" data-sc="text link:topic link">Preliminary estimates</a>,
559-
560: <a href="/topic/matrix-inversion/" data-sc="text link:topic link">Matrix inversion</a>
561-
562- </div>
563-
564- <div class="mvl left">
565-
566-
567-
568-
569-<div id="flag-description" aria-live="assertive">
570- <a class="hover" data-qa="give-feedback" data-toggle="flag-reason" href="#" title="Give feedback on the topics for this item.">
ṔS2: 完全な*htmlファイル:https://pastebin.com/RLnWXKWe
ベストアンサー1
cat *html | grep -oE '\"\/.*\/\"' | awk -F'/' '{print $(NF-1)}'
これはうまくいきます。