Skip to content

Commit 18357e4

Browse files
committed
Quick Save
1 parent dc905df commit 18357e4

File tree

36 files changed

+1474
-287
lines changed

36 files changed

+1474
-287
lines changed

Makefile

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,12 @@ ifeq ($(OS), Windows)
1515
endif
1616

1717

18-
build$(EXT): bin/csvcols$(EXT) bin/csvrows$(EXT) bin/csvfind$(EXT) bin/csvjoin$(EXT) bin/jsoncols$(EXT) bin/jsonrange$(EXT) bin/xlsx2json$(EXT) bin/xlsx2csv$(EXT) bin/csv2mdtable$(EXT) bin/csv2xlsx$(EXT) bin/csv2json$(EXT) bin/vcard2json$(EXT) bin/jsonjoin$(EXT) bin/jsonmunge$(EXT) bin/findfile$(EXT) bin/finddir$(EXT) bin/mergepath$(EXT) bin/reldate$(EXT) bin/range$(EXT) bin/timefmt$(EXT) bin/urlparse$(EXT) bin/csvcleaner$(EXT) bin/string$(EXT)
18+
build$(EXT): bin/csvcols$(EXT) bin/csvrows$(EXT) bin/csvfind$(EXT) bin/csvjoin$(EXT) \
19+
bin/jsoncols$(EXT) bin/jsonrange$(EXT) bin/xlsx2json$(EXT) bin/xlsx2csv$(EXT) \
20+
bin/csv2mdtable$(EXT) bin/csv2xlsx$(EXT) bin/csv2json$(EXT) bin/jsonjoin$(EXT) \
21+
bin/jsonmunge$(EXT) bin/findfile$(EXT) bin/finddir$(EXT) bin/mergepath$(EXT) \
22+
bin/reldate$(EXT) bin/range$(EXT) bin/timefmt$(EXT) bin/urlparse$(EXT) \
23+
bin/csvcleaner$(EXT) bin/string$(EXT)
1924

2025

2126
bin/csvcols$(EXT): datatools.go cmds/csvcols/csvcols.go
@@ -51,9 +56,6 @@ bin/csv2json$(EXT): datatools.go cmds/csv2json/csv2json.go
5156
bin/csvfind$(EXT): datatools.go cmds/csvfind/csvfind.go
5257
go build -o bin/csvfind$(EXT) cmds/csvfind/csvfind.go
5358

54-
bin/vcard2json$(EXT): datatools.go cmds/vcard2json/vcard2json.go
55-
go build -o bin/vcard2json$(EXT) cmds/vcard2json/vcard2json.go
56-
5759
bin/jsonmunge$(EXT): datatools.go cmds/jsonmunge/jsonmunge.go
5860
go build -o bin/jsonmunge$(EXT) cmds/jsonmunge/jsonmunge.go
5961

@@ -132,7 +134,6 @@ install:
132134
env GOBIN=$(GOPATH)/bin go install cmds/range/range.go
133135
env GOBIN=$(GOPATH)/bin go install cmds/timefmt/timefmt.go
134136
env GOBIN=$(GOPATH)/bin go install cmds/urlparse/urlparse.go
135-
env GOBIN=$(GOPATH)/bin go install cmds/vcard2json/vcard2json.go
136137
env GOBIN=$(GOPATH)/bin go install cmds/xlsx2json/xlsx2json.go
137138
env GOBIN=$(GOPATH)/bin go install cmds/xlsx2csv/xlsx2csv.go
138139
env GOBIN=$(GOPATH)/bin go install cmds/csvcleaner/csvcleaner.go
@@ -153,7 +154,6 @@ dist/linux-amd64:
153154
env GOOS=linux GOARCH=amd64 go build -o dist/bin/csv2json cmds/csv2json/csv2json.go
154155
env GOOS=linux GOARCH=amd64 go build -o dist/bin/jsonmunge cmds/jsonmunge/jsonmunge.go
155156
env GOOS=linux GOARCH=amd64 go build -o dist/bin/jsonjoin cmds/jsonjoin/jsonjoin.go
156-
env GOOS=linux GOARCH=amd64 go build -o dist/bin/vcard2json cmds/vcard2json/vcard2json.go
157157
env GOOS=linux GOARCH=amd64 go build -o dist/bin/findfile cmds/findfile/findfile.go
158158
env GOOS=linux GOARCH=amd64 go build -o dist/bin/finddir cmds/finddir/finddir.go
159159
env GOOS=linux GOARCH=amd64 go build -o dist/bin/mergepath cmds/mergepath/mergepath.go
@@ -180,7 +180,6 @@ dist/macosx-amd64:
180180
env GOOS=darwin GOARCH=amd64 go build -o dist/bin/csv2mdtable cmds/csv2mdtable/csv2mdtable.go
181181
env GOOS=darwin GOARCH=amd64 go build -o dist/bin/csv2xlsx cmds/csv2xlsx/csv2xlsx.go
182182
env GOOS=darwin GOARCH=amd64 go build -o dist/bin/csv2json cmds/csv2json/csv2json.go
183-
env GOOS=darwin GOARCH=amd64 go build -o dist/bin/vcard2json cmds/vcard2json/vcard2json.go
184183
env GOOS=darwin GOARCH=amd64 go build -o dist/bin/jsonmunge cmds/jsonmunge/jsonmunge.go
185184
env GOOS=darwin GOARCH=amd64 go build -o dist/bin/jsonjoin cmds/jsonjoin/jsonjoin.go
186185
env GOOS=darwin GOARCH=amd64 go build -o dist/bin/findfile cmds/findfile/findfile.go
@@ -210,7 +209,6 @@ dist/windows-amd64:
210209
env GOOS=windows GOARCH=amd64 go build -o dist/bin/csv2mdtable.exe cmds/csv2mdtable/csv2mdtable.go
211210
env GOOS=windows GOARCH=amd64 go build -o dist/bin/csv2xlsx.exe cmds/csv2xlsx/csv2xlsx.go
212211
env GOOS=windows GOARCH=amd64 go build -o dist/bin/csv2json.exe cmds/csv2json/csv2json.go
213-
env GOOS=windows GOARCH=amd64 go build -o dist/bin/vcard2json.exe cmds/vcard2json/vcard2json.go
214212
env GOOS=windows GOARCH=amd64 go build -o dist/bin/jsonmunge.exe cmds/jsonmunge/jsonmunge.go
215213
env GOOS=windows GOARCH=amd64 go build -o dist/bin/jsonjoin.exe cmds/jsonjoin/jsonjoin.go
216214
env GOOS=windows GOARCH=amd64 go build -o dist/bin/findfile.exe cmds/findfile/findfile.go
@@ -241,7 +239,6 @@ dist/raspbian-arm7:
241239
env GOOS=linux GOARCH=arm GOARM=7 go build -o dist/bin/csv2mdtable cmds/csv2mdtable/csv2mdtable.go
242240
env GOOS=linux GOARCH=arm GOARM=7 go build -o dist/bin/csv2xlsx cmds/csv2xlsx/csv2xlsx.go
243241
env GOOS=linux GOARCH=arm GOARM=7 go build -o dist/bin/csv2json cmds/csv2json/csv2json.go
244-
env GOOS=linux GOARCH=arm GOARM=7 go build -o dist/bin/vcard2json cmds/vcard2json/vcard2json.go
245242
env GOOS=linux GOARCH=arm GOARM=7 go build -o dist/bin/jsonmunge cmds/jsonmunge/jsonmunge.go
246243
env GOOS=linux GOARCH=arm GOARM=7 go build -o dist/bin/jsonjoin cmds/jsonjoin/jsonjoin.go
247244
env GOOS=linux GOARCH=arm GOARM=7 go build -o dist/bin/findfile cmds/findfile/findfile.go

README.md

Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,39 +6,37 @@ Posix shell scripting (e.g. writing scripts that run under Bash). The tools are
66

77
## For data
88

9-
Command line utilities for simplifying work with CSV, JSON, Excel Workbooks and plain text files or content and
10-
general purpose shell scripting.
9+
Command line utilities for simplifying work with CSV, JSON, Excel Workbooks and plain text files or content.
1110

12-
+ [csv2json](docs/csv2json.html) - a tool to take a CSV file and convert it into a JSON blob array or a list of JSON blobs one per line
11+
+ [csv2json](docs/csv2json.html) - a tool to take a CSV file and convert it into a JSON array or a list of JSON blobs one per line
1312
+ [csv2mdtable](docs/csv2mdtable.html) - a tool to render CSV as a Github Flavored Markdown table
14-
+ [csv2xlsx](docs/csv2xlsx.html) - a tool to take a CSV file and add it as a sheet to a Excel Workbook file.
15-
+ [csvcleaner](docs/csvcleaner.html) - normalize a CSV column by column count, delimiter handling, space trimming
13+
+ [csv2xlsx](docs/csv2xlsx.html) - a tool to take a CSV file and add it as a sheet to a Excel Workbook
14+
+ [csvcleaner](docs/csvcleaner.html) - normalize a CSV file by column and row including trimming spaces and removing comments
1615
+ [csvcols](docs/csvcols.html) - a tool for formatting command line arguments into CSV row of columns or filtering CSV rows for specific columns
17-
+ [csvfind](docs/csvfind.html) - a tool for filtering a CSV file by column's value
18-
+ [csvjoin](docs/csvjoin.html) - a tool to join to CSV files on common values in designated columns, writes combined CSV rows to stdout
16+
+ [csvfind](docs/csvfind.html) - a tool for filtering a CSV file rows by column
17+
+ [csvjoin](docs/csvjoin.html) - a tool to join two CSV files on common values in designated columns, writes combined CSV rows
1918
+ [csvrows](docs/csvrows.html) - a tool for formatting command line arguments into CSV columns of rows or filtering CSV columns for specific rows
2019
+ [jsoncols](docs/jsoncols.html) - a tool for exploring and extracting JSON values into columns
2120
+ [jsonjoin](docs/jsonjoin.html) - a tool for joining JSON object documents
2221
+ [jsonmunge](docs/jsonmunge.html) - a tool to transform JSON documents into something else
23-
+ [jsonrange](docs/jsonrange.html) - a tool for iterating for JSON maps and arrays
24-
+ [vcard2json](docs/vcard2json.html) - an experimental tool to convert vCards to JSON
25-
+ [xlsx2csv](docs/xlsx2csv.html) - a tool for converting Excel Workbooks sheets to a CSV file(s)
22+
+ [jsonrange](docs/jsonrange.html) - a tool for iterating over JSON objects and arrays (return keys or values)
23+
+ [xlsx2csv](docs/xlsx2csv.html) - a tool for converting Excel Workbooks sheets to CSV files
2624
+ [xlsx2json](docs/xlsx2json.html) - a tool for converting Excel Workbooks to JSON files
2725

2826

2927
Compiled versions are provided for Linux (amd64), Mac OS X (amd64),
3028
Windows 10 (amd64) and Raspbian (ARM7). See https://github.com/caltechlibrary/datatools/releases.
3129

32-
Use the utilities try "-help" option for a full list of options for each utility.
30+
Use "-help" option for a full list of options for each utility (e.g. `csv2json -help`).
3331

3432
## For strings
3533

36-
_datatools_ provides for working with string data (limited to memory available) as this is commonly needed when cleanup data for
37-
analysis and the old Unix stand bys- grep, awk, sed, tr are at times unwieldly. For the
38-
time things that are common in most language like, trimming, spliting, joining and transforming
39-
case we provide the [string](docs/string/) command. The _string_ command also makes it easy
40-
to join JSON string arrays into a string using a delimiter or split a string into a JSON array
41-
based on a delimiter. The form of the command is `string [OPTIONS] [ACTION] [ARCTIONS_PARAMETERS...]`
34+
_datatools_ provides the [string](docs/string/) command for working with text strings (limited to memory available).
35+
This is commonly needed when cleanup data for analysis. The _string_ command was created for when the old Unix
36+
stand bys- grep, awk, sed, tr are unwieldly or inconvient. _string_ provides operations are common in most language
37+
like, trimming, spliting, and transforming letter case. The _string_ command also makes it easy to join
38+
JSON string arrays into single a string using a delimiter or split a string into a JSON array
39+
based on a delimiter. The form of the command is `string [OPTIONS] [ACTION] [ARCTION_PARAMETERS...]`
4240

4341
```shell
4442
string toupper "one two three"
@@ -76,13 +74,12 @@ Use the utilities try "-help" option for a full list of options.
7674

7775
## Installation
7876

79-
_datatools_ is go get-able.
77+
See [INSTALL.md](install.html) for details for installing pre-compiled versions of the programs.
78+
79+
_datatools_ are go get-able. If you have go v1.8 (or newer) you can install with the command below.
8080

8181
```
8282
go get github.com/caltechlibrary/datatools/...
8383
```
8484

85-
Or see [INSTALL.md](install.html) for details for installing
86-
compiled versions of the programs.
87-
8885

cmds/csvfind/csvfind.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ func main() {
107107
app.StringVar(&outputFName, "o,output", "", "output filename")
108108
app.BoolVar(&quiet, "quiet", false, "suppress error messages")
109109
app.BoolVar(&newLine, "nl,newline", true, "include trailing newline from output")
110+
app.BoolVar(&generateMarkdownDocs, "generate-markdown-docs", false, "generation markdown documentation")
110111

111112
// App Options
112113
app.IntVar(&col, "col,cols", 0, "column to search for match in the CSV file")

cmds/jsoncols/jsoncols.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ func main() {
109109
app.StringVar(&outputFName, "o,output", "", "output filename")
110110
app.BoolVar(&quiet, "quiet", false, "suppress error messages")
111111
app.BoolVar(&newLine, "nl,newline", false, "if true add a trailing newline")
112+
app.BoolVar(&generateMarkdownDocs, "generate-markdown-docs", false, "generate markdown documentation")
112113

113114
// Application Specific Options
114115
app.BoolVar(&runInteractive, "r", false, "run interactively")

cmds/jsonmunge/jsonmunge.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ func main() {
8686
app.BoolVar(&showExamples, "examples", false, "display example(s)")
8787
app.StringVar(&inputFName, "i,input", "", "input filename")
8888
app.StringVar(&outputFName, "o,output", "", "output filename")
89-
app.BoolVar(&generateMarkdownDocs, "generateMarkdownDocs", false, "generate markdown documentation")
89+
app.BoolVar(&generateMarkdownDocs, "generate-markdown-docs", false, "generate markdown documentation")
9090
app.BoolVar(&quiet, "quiet", false, "suppress error messages")
9191
app.BoolVar(&newLine, "nl,newline", false, "if true add a trailing newline")
9292

cmds/jsonrange/jsonrange.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ func main() {
259259
app.BoolVar(&showExamples, "examples", false, "display example(s)")
260260
app.StringVar(&inputFName, "i,input", "", "read JSON from file")
261261
app.StringVar(&outputFName, "o,output", "", "write to output file")
262-
app.BoolVar(&generateMarkdownDocs, "generateMarkdownDocs", false, "generate markdown docs")
262+
app.BoolVar(&generateMarkdownDocs, "generate-markdown-docs", false, "generate markdown docs")
263263
app.BoolVar(&quiet, "quiet", false, "suppress error messages")
264264
app.BoolVar(&newLine, "nl,newline", false, "if true add a trailing newline")
265265

cmds/reldate/reldate.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ func main() {
157157
app.BoolVar(&showExamples, "examples", false, "display example(s)")
158158
app.BoolVar(&quiet, "quiet", false, "suppress error messages")
159159
app.BoolVar(&newLine, "nl,newline", true, "if true add a trailing newline")
160+
app.BoolVar(&generateMarkdownDocs, "generate-markdown-docs", false, "generate markdown documentation")
160161

161162
// App Specific Options
162163
app.StringVar(&relativeTo, "f,from", relativeTo, relativeToUsage)

cmds/vcard2json/vcard2json.go

Lines changed: 0 additions & 138 deletions
This file was deleted.

datatools.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ import (
3535
)
3636

3737
const (
38-
Version = `v0.0.20-dev`
38+
Version = `v0.0.20-pre`
3939

4040
LicenseText = `
4141
%s %s

demos/csv2json/index.html

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<title>Caltech Library's Digital Library Development Sandbox</title>
5+
<link href='https://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'>
6+
<link rel="stylesheet" href="/css/site.css">
7+
</head>
8+
<body>
9+
<header>
10+
<a href="http://library.caltech.edu"><img src="/assets/liblogo.gif" alt="Caltech Library logo"></a>
11+
</header>
12+
<nav>
13+
<ul>
14+
<li><a href="/">Home</a></li>
15+
<li><a href="./">README</a></li>
16+
<li><a href="license.html">LICENSE</a></li>
17+
<li><a href="install.html">INSTALL</a></li>
18+
<li><a href="docs/">Documentation</a></li>
19+
<li><a href="how-to/">How To</a></li>
20+
<li><a href="https://github.com/caltechlibrary/datatools">Github</a></li>
21+
</ul>
22+
23+
</nav>
24+
25+
<section>
26+
<h1>Demo of csv2json</h1>
27+
28+
<p>Convert data1.csv to data1.json using command line options and Unix pipes. The result will be an array
29+
of JSON objects.</p>
30+
31+
<pre><code class="language-shell"> csv2json -i data1.csv -o data1.json
32+
cat data1.csv | csv2json &gt; data1.json
33+
</code></pre>
34+
35+
<p>Convert data1.csv to JSON blobs, one line per blob.</p>
36+
37+
<pre><code class="language-shell"> csv2json -as-blobs -i data1.csv
38+
cat data1.csv | csv2json -as-blobs
39+
</code></pre>
40+
41+
</section>
42+
43+
<footer>
44+
<span><h1><A href="http://caltech.edu">Caltech</a></h1></span>
45+
<span>&copy; 2017 <a href="https://www.library.caltech.edu/copyright">Caltech library</a></span>
46+
<address>1200 E California Blvd, Mail Code 1-32, Pasadena, CA 91125-3200</address>
47+
<span>Phone: <a href="tel:+1-626-395-3405">(626)395-3405</a></span>
48+
<span><a href="mailto:[email protected]">Email Us</a></span>
49+
<a class="cl-hide" href="sitemap.xml">Site Map</a>
50+
</footer>
51+
</body>
52+
</html>

0 commit comments

Comments
 (0)