Skip to content

tst2005sh/pata

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pata

Pata is an utility to helps for automation and data processing tasks.

Made with

Mainly with

  • POSIX shell (bash when POSIX is too poor)
  • grep,sed,find,cut,...

But also with some thirdparty utils:

  • jq (for all json stuff)
  • tidy (for html to xml)
  • xml2json.py (for xml to json)
  • csv2json.py (for csv to json)

Some experimental stuff use:

  • sqlite3 (for SQL)
  • xls, xlsx ods support (to read from spreadsheet files)
  • curl,wget (for download and REST API)
  • ping (for network stuff)

Convertion list

  • csv/json_array
  • csv/json_object
  • json_array/csv
  • json_object/csv ( json_object/json_array + json_array/csv )
  • json_object/json_array
  • json_object/rgrep ( json/rgrepn + rgrepn/rgrep )
  • json_object/rgrepn
  • xml/json
  • html/json
  • html/xml
  • rgrepn/json_object
  • rgrepn/rgrep
  • rgrep/json_object ( rgrep/rgrepn + rgrepn/json_object )
  • rgrep/rgrepn
  • yaml/json

TODO:

  • xls/json
  • xlsx/json
  • ods/json
  • mbox <-> json
  • maildir/maildir+ <-> json
  • http header <-> json
  • curl (header and body) <-> json
  • json/yaml

Convertion matrix

col to row csv json_a json_o xml yaml html rgrepn rgrep
csv - yes yes no no no no no
json_array yes - yes - - no no
json_object yes TODO - - - yes yes
json(struct) - - - yes yes yes - -
xml no no no - yes no no
html no no no no TODO** no no
rgrepn no no yes no no - yes
rgrep no no yes no no yes -
yaml TODO TODO

(*: via convertion) (**: via tidy )

jsonA means json array like :

[
	["head1", "head2", "head3"],
	["x=1 y=1", "x=2 y=1", "x=3 y=1",
	["x=1 y=2", "x=2 y=2", "x=3 y=2"
]

jsonO means json Object like :

[
	{"head1": "x=1 y=1", "head2": "x=2 y=1", "head3": "x=3 y=1"},
	{"head1": "x=1 y=2", "head2": "x=2 y=2", "head3": "x=3 y=2"}
]

Convertion implementation alternative

csv to json

json to csv

  • jq
  • (py ? lua ?)

json to rgrepn

  • jq
  • (py ? lua ?)

json to rgrep

Alias: json to rgrepn, rgrepn to rgrep

xml to json

html to json

Alias: html to xml, xml to json

html to xml

  • tidy -asxml

html to html

Rewrite "bad" html to strict html.

  • tidy -ashtml

rgrepn to json

  • jq
  • (py ? lua ?)

rgrep to rgrepn

  • sh
  • (py ? lua ?)

rgrep to json

Alias: rgrep to rgrepn, rgrepn to json

About

Partial Automation and Technical Analysis

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages