Skip to content

Instantly share code, notes, and snippets.

@ivon852
Created September 28, 2022 17:58
Show Gist options
  • Select an option

  • Save ivon852/1bdf8eff821ecac9330d4719f0841b39 to your computer and use it in GitHub Desktop.

Select an option

Save ivon852/1bdf8eff821ecac9330d4719f0841b39 to your computer and use it in GitHub Desktop.
Markdown sort tableby numbers 表格數字排序
# 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