published: 2020-02-04
started: 2020-02-04
last change: 2022-05-26
started: 2020-02-04
last change: 2022-05-26
How to Generate a Table of Contents on the Command Line
Generate a TOC for an HTML page with this command on the Linux command line:
me@hostname:~$ cat 2020-01-14_auto_vectorization_in_java.html \ | grep '<h. ' | sed 's|<h. id="|<a style="margin-left: 0em" href="#|' | sed 's|</h.>|</a><br/>|' <a style="margin-left: 0em" href="#Abstract">Abstract</a><br/> <a style="margin-left: 0em" href="#Contents">Contents</a><br/> <a style="margin-left: 0em" href="#Introduction">1. Introduction</a><br/> <a style="margin-left: 0em" href="#SIMD">1.1. SIMD</a><br/> <a style="margin-left: 0em" href="#Vectorization">1.2. Vectorization</a><br/> <a style="margin-left: 0em" href="#Vector Instructions in Java">1.3. Vector Instructions in Java</a><br/> <a style="margin-left: 0em" href="#Code That Can Benefit From Vectorization">2. Code That Can Benefit From Vectorization</a><br/> <a style="margin-left: 0em" href="#Check If Vectorization Is Applied">3. Check If Vectorization Is Applied</a><br/> <a style="margin-left: 0em" href="#Prepare a Mirco Benchmark">3.1. Prepare a Mirco Benchmark</a><br/> <a style="margin-left: 0em" href="#Run the Mirco Benchmark">3.2. Run the Mirco Benchmark</a><br/> <a style="margin-left: 0em" href="#Output Interpretation">3.3. Output Interpretation</a><br/> <a style="margin-left: 0em" href="#Footnotes">4. Footnotes</a><br/> <a style="margin-left: 0em" href="#References">5. References</a><br/> me@hostname:~$ █
Snippet 1: Generated TOC
... <h2 id="Introduction">1. Introduction</h2> ...
Snippet 2: A Heading in an HTML Page