Extract a specific row from a table
Goal: Pull a single row out of a Markdown table by its position.
Prerequisites: None.
Query
.[2][]
$ mq '.[2][]' README.md
Input
| Name | Age | City |
| ----- | --- | ---- |
| Alice | 30 | NYC |
| Bob | 25 | LA |
Output
| Bob | 25 | LA |
Notes
- Row indexing starts at the header: index
0is the header row,1is the first data row (Alice),2is the second (Bob). - To get the cells as plain values instead of a rendered row, add
-F jsonor-F csvto the command.