Created
September 28, 2022 17:58
-
-
Save ivon852/1bdf8eff821ecac9330d4719f0841b39 to your computer and use it in GitHub Desktop.
Markdown sort tableby numbers 表格數字排序
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Reference: https://christiantietze.de/posts/2017/05/sort-markdown-tables-shell/ | |
| # Example input file: | |
| # |Name|Year|Pictures|Description| | |
| # |---|---|---|---| | |
| # |A |2022|foo|bar| | |
| # |B |2012|bar|boo| | |
| # |C |2009|boo|bar| | |
| # Sort by column 2 (year), latest first: | |
| tail -n +3 table.md | sort -n -r --field-separator=\ | --key=3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment