Paste Command Examples
Here are practical examples demonstrating how to use tabtomd with the
paste command to convert tab-delimited data from the clipboard into
Markdown tables.
Convert tab-delimited text from the clipboard to a Markdown table and print it to the screen
Suppose you have copied the following tab-delimited data to the clipboard:
Name Species Gender
Ariel Mermaid Female
Sebastian Crab Male
Chef Louis Human Male
Prince Eric Human Male
Ursula Octopus FemaleTo convert this clipboard text into a Markdown table and print it to the
screen, use the paste command with the
--print flag:
tabtomd paste --printtabtomd reads the tab-delimited text from the clipboard, treats the first row as a header, and outputs the following Markdown table:
| Name | Species | Gender |
| ----- | ----- | ----- |
| Ariel | Mermaid | Female |
| Sebastian | Crab | Male |
| Chef Louis | Human | Male |
| Prince Eric | Human | Male |
| Ursula | Octopus | Female |--pretty flag, the Markdown table is functional but
not aligned. Columns are spaced according to the length of the text, which
may affect readability.Convert tab-delimited text from the clipboard to an aligned Markdown table and print it to the screen
To create a neatly aligned Markdown table with evenly spaced columns, use
the --pretty flag along with the --print flag:
tabtomd paste --pretty --printThis produces an aligned Markdown table as shown below:
| Name | Species | Gender |
| ----------- | ------- | ------ |
| Ariel | Mermaid | Female |
| Sebastian | Crab | Male |
| Chef Louis | Human | Male |
| Prince Eric | Human | Male |
| Ursula | Octopus | Female |--pretty flag, the Markdown table is aligned.Convert tab-delimited text from the clipboard to an aligned Markdown table and save it to a file
To save the converted table to a file instead of printing it to the screen,
use the --output flag. When this flag is
used, the output is redirected to the specified file.
For example:
tabtomd paste --output characters.md --prettyThis creates a new file, characters.md, containing the aligned Markdown
table. To verify, you can view the file’s content:
cat characters.mdOutput:
| Name | Species | Gender |
| ----------- | ------- | ------ |
| Ariel | Mermaid | Female |
| Sebastian | Crab | Male |
| Chef Louis | Human | Male |
| Prince Eric | Human | Male |
| Ursula | Octopus | Female |--output flag to save the Markdown table to a file.These examples demonstrate how tabtomd can easily convert tab-delimited
data from the clipboard into Markdown format, offering both quick display
options and the ability to save the output for later use. Using the
--pretty flag ensures the results are well-aligned and visually appealing
for improved readability.