Skip to content

Commit

Permalink
docs(csv): 📝 Add bits to csv examples
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisguest75 committed Jul 10, 2024
1 parent 4c63c6e commit 241d531
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 20 deletions.
1 change: 1 addition & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"recommendations": [
"mechatroner.rainbow-csv",
"ms-azuretools.vscode-docker",
"vivaxy.vscode-conventional-commits",
"davidanson.vscode-markdownlint",
Expand Down
37 changes: 17 additions & 20 deletions 12_csv/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ TODO:
* Validate data being piped
* tidy viewer - https://github.com/alexhallam/tv

NOTES:

* Use `mechatroner.rainbow-csv` in vscode. You can also use it to align fields.

## Example

Show how to read a csv file and loop over it row by row.
Expand All @@ -16,7 +20,9 @@ Show how to read a csv file and loop over it row by row.
./parse_csv.sh
```

## CSV 2 JSON
## Conversion

### CSV 2 JSON

An example script to take a csv data piped in and convert it into a json document.

Expand All @@ -25,6 +31,14 @@ An example script to take a csv data piped in and convert it into a json documen
cat ./test.map | ./csv2json.sh
```

### TSV 2 CSV

Convert a TSV to CSV

```sh
tr '\t' ',' < ./file.tsv > ./file.csv
```

## Generate CSV from CPU data

```sh
Expand All @@ -41,22 +55,5 @@ sqlite3 :memory: -cmd '.mode csv' -cmd '.import cpu.csv cpu' 'SELECT time, COUNT
## Resources

* My jq examples [here](../jq/README.md)

https://til.simonwillison.net/sqlite/one-line-csv-operations


https://news.ycombinator.com/item?id=28670252
https://github.com/alexhallam/tv



iostat
vm_stat
ps wwaux | grep code

ps -opcpu -opid -ocomm -cax | sort

sed 's/\t/ /g' test.txt |sed 's/ */ /g' |sed 's/ /,/g'

sudo powermetrics --samplers smc | grep -i "CPU die temperature"

* https://til.simonwillison.net/sqlite/one-line-csv-operations
* TidyViewer [here](https://github.com/alexhallam/tv)

0 comments on commit 241d531

Please sign in to comment.