Skip to content

Commit 15c1a10

Browse files
author
Daulet Zhanguzin
committed
add better examples
1 parent 96724c5 commit 15c1a10

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

README.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,3 +81,45 @@ and here is the result with web search enabled (`cmd -connectors web-search`):
8181

8282
![gif of a bouncing ball](./.github/ball_web.gif)
8383

84+
## Data transformation
85+
86+
A common mundane task that this tool could simplify is transforming or otherwise parsing data from one format to another. However, there are multiple ways to approach this, e.g. you could ask LLM to transform the data directly, or you could ask cmd to write a program to transform the data. The better solution depends on the amount of data you have, and the complexity of the transformation.
87+
```bash
88+
cat house-prices.csv | cmd convert to json
89+
```json
90+
[
91+
{
92+
"Home": 1,
93+
"Price": 114300,
94+
"SqFt": 1790,
95+
"Bedrooms": 2,
96+
"Bathrooms": 2,
97+
"Offers": 2,
98+
"Brick": "No",
99+
"Neighborhood": "East"
100+
},
101+
{ ...
102+
```
103+
104+
Programmatic approach (program is still written by LLM):
105+
```bash
106+
cat house-prices.csv | cmd -exec write python program to convert this to json and read the data from house-prices.csv
107+
[
108+
{
109+
"Home": "1",
110+
"Price": "114300",
111+
"SqFt": "1790",
112+
"Bedrooms": "2",
113+
"Bathrooms": "2",
114+
"Offers": "2",
115+
"Brick": "No",
116+
"Neighborhood": "East"
117+
},
118+
{ ...
119+
```
120+
121+
Of course whichever approach you choose, you can always pipe the output to another command to further process it.
122+
123+
```bash
124+
cat house-prices.csv | cmd -exec write python program to convert this to json and print it out, read the data from house-prices.csv | cmd -run run python program to plot this data
125+
```

0 commit comments

Comments
 (0)