csvmask is a CSV masking tool.
- Prepare CSV encoded data
$ cat testdata/test.csv
"ID","Name","Address"
4085ff59-39bd-4cc3-8a55-c5b1c6785922,Adam Smith,Kirkcaldy United Kingdom
- Create template
{{.Field1}},{{hash .Field2}},{{.Field3}}
- Execute csvmask with template
$ cat testdata/test.csv | csvmask -template "{{.Field1}},{{hash .Field2}},{{.Field3}}" -skipheader
ID,Name,Address
4085ff59-39bd-4cc3-8a55-c5b1c6785922,PbZ8hc4alo56RYc9/m+vECyVdjHqZRGMlxUGigh3/uE,Kirkcaldy United Kingdom
The template is a text of text/template package of Go.
The fields of CSV record can be referred as arguments. The name is preceeded by a period such as
- .Field1
- .Field2
- .Field3
- ...
The following functions are defined.
- hash
- checksum
- right
- left
Go to the releases page and download zip file.
$ go get -u github.com/takatoshiono/csvmask
First clone the repository and
$ make install