• Stars
    star
    6,948
  • Rank 5,647 (Top 0.2 %)
  • Language
  • Created over 9 years ago
  • Updated 4 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A list of command-line tools for manipulating structured text data

Structured text tools

The following is a list of text-based file formats and command line tools for manipulating each.

Contents

awk-like

Tools that work with lines of fields separated by delimiters but do not necessarily support CSV field quoting.

awk

AWK/awk is a programming language and a POSIX-standard command line tool. (You will sometimes see "awk" used for the tool and "AWK" for the language. This document follows this convention. GNU Awk uses "Awk".) If you run Linux, macOS, or a BSD, you almost certainly have it installed. See below for Windows.

  • If you already know how to program, the nawk man page is a great way to learn AWK quickly. What you learn from it will apply to other implementations on different platforms. Read it first if you feel overwhelmed by the sheer size of the GNU Awk manual.
  • awk.info archive β€” an extensive resource on Awk.
  • "AWK Vs NAWK Vs GAWK" β€” a comparison of features present in different implementations.
  • busybox-w32 includes a full implementation of POSIX awk and other tools like sed in a single Windows executable.
  • GNU Awk 5 binaries for Windows by EZWinPorts.
  • GoAWK is a cross-platform implementation of awk with added support for CSV. The project provides binaries for many platforms, including Windows.

POSIX commands

  • comm β€” Select the lines common to two sorted files or the lines contained in only one of them. (Manual: man 1 comm on your system, GNU, FreeBSD.)
  • cut β€” Select portions of each line in one or more files. (Manual: man 1 cut, GNU, FreeBSD.)
  • grep β€” Select the lines that match or do not match a pattern from one or more files. (Manual: man 1 grep, GNU, FreeBSD.)
  • join β€” Take two files sorted by a common field and join their lines on the value of that field. Lines with values that do not appear in the other file are discarded. (Manual: man 1 join, GNU, FreeBSD.)
  • paste β€” Combine several consecutive lines in a text file into one. (Manual: man 1 paste, GNU, FreeBSD.)
  • sort β€” Sort lines by key fields. (Manual: man 1 sort, GNU, FreeBSD.)
  • uniq β€” Find or remove repeated lines. (Manual: man 1 uniq, GNU, FreeBSD.)

Other tools

  • csvquote β€” See the CSV section.
  • GNU datamash β€” Perform statistical operations on text input.
  • Hawk β€” Transform text from the command-line using Haskell expressions.
  • rq β€” See the JSON section.

CSV

CSV, TSV, and other delimiter-separated value formats. Tools belong on this list if they support field quoting.

  • csv-nix-tools β€” List *nix system information such as environment variables, files, processes, network connections, users as CSV. Manipulate and pretty-print CSV. Execute CSV rows as commands.
  • csv2md β€” Convert CSV to Markdown tables.
  • csv2html β€” Convert CSV to HTML tables.
  • csvfaker β€” Generate CSV files with fake data. Supports different types of fake data in different locales: names, cities, jobs, email addresses, and others.
  • csvfix (unofficial mirror) β€” A multitool. Compare, filter, normalize, split, and validate CSV files. Reorder, remove, split, and merge fields. Convert data between fixed-width, multi-line, XML, and DSV format. Generate SQL statements.
  • csvkit β€” csvkit is a suite of command-line tools for converting to and working with CSV: convert, clean, cut, grep, join, sort, stack, format, render, query, analyze, etc.
  • csvquote β€” Transform CSV to and from a format processable with awk-like tools.
  • csvtk β€” Search, sample, cut, join, transpose, and sort CSV/TSV files. Rename columns. Replace fields and generate new fiends from existing fields. Plot data as vector or raster histograms and box, line, and scatter plots. Convert CSV to Markdown. Convert XLSX to CSV. Split XLSX sheets.
  • CSVtoTable β€” Convert CSV to a searchable and sortable HTML table.
  • dasel β€” See the JSON section.
  • GoAWK β€” GoAWK is an awk implementation that adds a CSV mode for input and for output.
  • Graphtage β€” See the JSON section.
  • jp (sgreben) β€” Plot data. See the JSON section.
  • Mario β€” See the JSON section.
  • MCMD (M-Command) β€” Select, sample, cut, join, sort, reformat, and generate CSV files. Contains a large set of commands.
  • Miller β€” sed, awk, cut, join and sort for name-indexed data such as CSV and tabular JSON.
  • pawk β€” Process text with AWK-like patterns, but Python code.
  • rows β€” A Python library with a CLI. Convert between a number of file formats for tabular data: CSV, XLS, XLSX, ODS, and others. Query the data (via SQLite). Combine tables. Generate schemas.
  • rq β€” See the JSON section.
  • scrubcsv β€” Remove bad lines from a CSV file and normalize the rest. Written in Rust.
  • tab β€” A non-Turing-complete statically typed programming language for data processing. An alternative to awk.
  • teip β€” Select fields, character ranges, or regular expression matches from standard input. Replace them with the output of a command.
  • eBay's TSV utilities β€” Filtering, statistics, sampling, joins and other operations on TSV files. High performance, especially good for large datasets. Written in D.
  • tv β€” View delimited files in the terminal.
  • VisiData β€” Explore interactively data in TSV, CSV, XLS, XLSX, HDF5, JSON, and other formats. Introduction.
  • xsv β€” Index, slice, analyze, split, and join CSV files.

SQL-based tools

See the big comparison table. It covers

  • AlaSQL CLI
  • csvq
  • csvsql
  • fsql
  • q
  • RBQL
  • rows
  • Sqawk (dbohdan)
  • sqawk (tjunier)
  • Squawk
  • termsql
  • trdsql
  • textql

JSON

  • clconf β€” See the YAML section.
  • dasel β€” Query and update data structures from the command line. Comparable to jq/yq but supports JSON, TOML, YAML, and XML. Static binaries available for releases.
  • fx β€” Run arbitrary JavaScript on JSON input. Standalone binaries available.
  • gojq β€” A pure Go implementation of jq (see below). Supports YAML input and output.
  • Graphtage β€” Compare and merge tree-like structures semantically. Supports JSON, JSON5, XML, HTML, YAML, and CSV. Can be used as a Python library.
  • gron β€” Convert JSON to and from flat, greppable lists of "path=value" statements.
  • JC β€” Convert the output of standard command line tools to JSON.
  • jello β€” Query JSON and JSON Lines with Python code. Output the result in a line-based format suitable for creating Bash arrays. Generate a grep-able schema.
  • jet β€” Convert between and query JSON, Clojure's edn, and Transit.
  • jfq β€” Query and transform JSON with the JSONata language.
  • jid β€” Explore JSON interactively with filtering queries like jq.
  • jiq β€” Explore JSON interactively with jq. Requires jq.
  • jj β€” Query and modify values in JSON or JSON Lines with a key path.
  • jl β€” Query and manipulate JSON using a tiny functional language.
  • jo β€” Create JSON objects from the shell.
  • jp (jmespath) β€” Query JSON with JMESPath.
  • jp (sgreben) β€” Plot JSON and CSV data in the terminal. Supports different kinds of plots: bar charts, line charts, scatter plots, histograms, and heatmaps.
  • jplot β€” Plot real-time JSON data in the terminal (works with terminals supporting graphic rendering).
  • jq β€” Create and manipulate JSON with a functional (as in "functional programming") DSL. Can convert JSON to other formats.
  • jql β€” Create and manipulate JSON with a Lisp-syntax DSL.
  • jtbl β€” Format JSON or JSON Lines as a plain-text table.
  • jtc β€” Create, manipulate, search, validate JSON with path expressions. Can be used as a C++14 library.
  • emuto β€” CLI tool similar to jq. Create and manipulate JSON and other files. Can be compiled to JavaScript.
  • jshon β€” Create and manipulate JSON using getopt-style command-line options.
  • json2 β€” Convert JSON to and from flat, greppable lists of "path=value" statements. Modeled after xml2.
  • jsonaxe β€” Create and manipulate JSON with a Python-based DSL. Inspired by jq.
  • json β€” Run arbitrary JavaScript on JSON input.
  • json-table β€” Convert nested JSON into CSV or TSV for processing in the shell.
  • json.tool (Python 3 docs) β€” Validate and pretty-print JSON. This module is part of the standard library of Python 2/3 and is likely to be available wherever Python is installed.
  • jsonwatch β€” Track changes in JSON data from the command line. Works like watch -d.
  • lobar β€” Explore JSON interactively or process it in batch with a wrapper for lodash.chain(). An alternative to jq with a JavaScript syntax.
  • Mario β€” Manipulate and convert between CSV, JSON, YAML, TOML, and XML with Python code.
  • qpyson β€” Query and manipulate JSON with Python.
  • query-json β€” A faster jq implementation written in Reason Native (OCaml).
  • quicktype β€” Infer the underlying model of the JSON and output as types for various programming languages or JSON Schema. CLI and Web UI.
  • ramda-cli β€” Manipulate JSON with the Ramda functional library, and either LiveScript or JavaScript syntax.
  • RecordStream β€” Create, manipulate, and output a stream of records, or JSON objects. Can retrieve records from an SQL database, MongoDB, Atom feeds, XML, and other sources.
  • rq β€” Convert between Apache Avro, CBOR, CSV, JSON, MessagePack, Protocol Buffers, TOML, YAML, and awk-style plain text.
  • validjson β€” Validate or pretty-print JSON.
  • VisiData β€” Explore data interactively data. See the awk-like/Other tools section.

XML, HTML

  • dasel β€” Supports XML. See the JSON section.
  • Graphtage β€” See the JSON section.
  • hred β€” Query XML and HTML with a query language based on CSS selectors.
  • html-xml-utils β€” A number of simple utilities (like hxcopy, hxpipe, hxunent, hxselect) for manipulating HTML and XML files from W3C. Written in C, quite old-fashioned, but still relevant and maintained.
  • htmlq β€” Query HTML with CSS selectors. Can remove elements in the output.
  • Mario β€” Supports XML. See the JSON section.
  • pup β€” Query HTML pages with CSS selectors. Static binaries available for releases. Inspired by jq.
  • Saxon β€” Query XML and HTML data with XPath. Documentation.
  • sml2 β€” Convert between XML and SML, a simplified XML representation.
  • Temme β€” Query HTML with CSS-like selectors to extract JSON. Temme extends CSS selectors with value capture patterns.
  • tidy-html5 β€” Validate, fix, and reformat HTML(5), XHTML, and XML documents. Convert HTML to XHTML.
  • tq β€” Query HTML with CSS selectors.
  • Xidel β€” Query or modify XML and HTML pages with XPath, XQuery 3, and CSS selectors.
  • xml-to-json-fast β€” Convert XML to JSON. Can handle very large XML files.
  • xml2 β€” Convert XML and HTML to and from flat, greppable lists of "path=value" statements. Source code mirror.
  • xmljson β€” Convert multiple and large XML files to JSON. Written in Swift.
  • XMLLint β€” Query (including XSLT), validate and reformat XML documents.
  • XMLStarlet β€” Query, modify, and validate XML documents.
  • xq β€” jq wrapper for XML documents.
  • xsltproc β€” Transform XML documents using XSLT and EXSLT.

See also

YAML, TOML

With a format converter like Remarshal (below) you can use JSON tools to process YAML and TOML, but make sure you do not lose data in the conversion.

  • clconf β€” Merge multiple config files and extract values from them using path string. Supports JSON and YAML. Can be used as a Go library.
  • dasel β€” Supports TOML and YAML. See the JSON section.
  • gojq β€” Supports YAML. See the JSON section.
  • Graphtage β€” Supports YAML. See the JSON section.
  • Mario β€” Supports YAML. See the JSON section.
  • Remarshal β€” Convert between CBOR, JSON, MessagePack, TOML, and YAML. Validate each of the formats. Pretty-print JSON, TOML, and YAML.
  • rq β€” Supports TOML and YAML. See the JSON section.
  • shyaml β€” Query YAML. Can output null-terminated strings for use in shell scripts.
  • validtoml β€” Validate TOML.
  • validyaml β€” Validate or pretty-print YAML.
  • yaml-tools β€” A set of CLI tools to manipulate YAML files (merge, delete, etc...) with comment preservation, based on ruamel.yaml.
  • yq (kislyuk) β€” jq wrapper for YAML.
  • yq (mikefarah) β€” Query, modify, and merge YAML. Convert to and from JSON.

Configuration files

/etc/hosts

  • hostctl β€” Add and remove entires in /etc/hosts. Disable (comment out) and enable (uncomment) entires. Not idempotent. Preserves arbitrary comments above its section of the hosts file. Works with groups of entries called "profiles".
  • hostess β€” Add and remove entires in /etc/hosts. Disable (comment out) and enable (uncomment) entires. Check if a hostname exists. Reformat the hosts file. Convert the entries to JSON. Idempotent. Removes arbitrary comments.
  • hosts β€” Add and remove entires in /etc/hosts. Change a hostname's IP address. Idempotent. Preserves arbitrary comments. Can be used as a Tcl library.

INI

  • cfget
    • Platform: Any with Python 2.x?
    • License: GNU GPLv2+
    • Description: Retrieve properties as shell script commands to set the corresponding variables (with --dump exports). Retrieve properties' values as plain text. Substitute values from an INI file in an Autoconf-style template. Supports plug-ins. Chokes on section names and keys with spaces.
  • confget
    • Platform: Linux, FreeBSD
    • License: Two-clause BSD
    • Description: Retrieve properties and sections as shell script commands to set the corresponding variables. Retrieve properties' values as plain text. Check for existence of properties. List sections. Find values that match a pattern. Read-only.
  • crudini
    • Platform: Any with Python 2.x
    • License: GNU GPLv2
    • Description: Retrieve properties and sections as INI fragments or shell script commands to set the corresponding variables. Retrieve properties' values as plain text. Set properties. Remove properties and sections. Create empty sections. Merge INI files. Changes files in place.
  • inicomp
    • Platform: Windows, *nix
    • License: Apache 2.0
    • Description: Compare INI (and also Windows .reg) files.
  • IniFile (DOS version)
    • Platform: Windows (x86, x86-64), MS-DOS
    • License: Closed-source freeware
    • Description: Retrieve properties and sections as batch file commands to set the corresponding variables. Set properties. Remove properties and sections. Changes files in place.
  • initool
    • Platform: Linux, FreeBSD, Windows
    • License: MIT
    • Description: Retrieve properties and sections as INI fragments. Retrieve properties' values as plain text. Set properties. Check for existence of properties and sections. Remove properties and sections. Outputs the updated INI file.

Multiple formats

  • Augeas β€” Query and modify a number of file formats. Not all of the formats are equally well supported by Augeas and for some only a limited subset of all valid files can be parsed.
  • Elektra β€” Query and modify configuration files. Shares Augeas' limitations when it comes to application-specific configuration files (it uses the same lenses), but has better support for generic formats such as JSON and INI.

Log files

  • Squawk β€” Query Apache and Nginx log files. See the SQL-based tool comparison.
  • lnav β€” Query and watch log files. Has batch and interactive mode. Supported formats include the Common Log Format, CUPS page_log, syslog, strace, and generic timestamped messages. Can perform SQL queries.

Templating for structured text

Listed below are restricted programming language interpreters and templating tools that produce structured text output. They are generally intended to remove repetition in configuration files. They are distinct from unstructed templating tools like the jinja2 CLI program, which should not be added to this table.

  • CUE
    • Output format: JSON
    • Turing-complete: Yes?
    • Syntax: Extended JSON
    • I/O: ?
    • Description: A constraint language for JSON configuration data. Can generate and validates JSON.
  • Dhall
    • Output format: JSON, YAML
    • Turing-complete: No
    • Syntax: Haskell-inspired
    • I/O: Limited to importing libraries from files and HTTP(S) URLs (with protection against leaking your data to the server)
    • Description: A statically-typed functional configuration language. Has a standard formatting tool.
  • jk
    • Output format: JSON, YAML, plain text
    • Turing-complete: Yes
    • Syntax: JavaScript
    • I/O: Disk I/O
    • Description: Generate configuration files using JavaScript (V8 VM).
  • Jsonnet
    • Output format: JSON, INI, XML, YAML, plain text
    • Turing-complete: Yes
    • Syntax: Extended JSON
    • I/O: None
    • Description: A functional configuration language. Has a standard formatting tool.
  • rjsone
    • Output format: JSON, YAML
    • Turing-complete: No?
    • Syntax: Extended JSON
    • I/O: None
    • Description: A CLI tool for the JSON-e templating language.
  • ytt
    • Output format: YAML
    • Turing-complete: No
    • Syntax: YAML/Python hybrid
    • I/O: None?
    • Description: A templating tool for YAML built upon the Starlark configuration language.

Bonus round: CLIs for single-file databases

  • Firebird
    • Description: Firebird is a FOSS database that can be used from a single file, like SQLite. "isql is a program that allows the user to issue arbitrary SQL commands".
    • File format: Binary
  • Fsdb
    • Description: A flat-file database for shell scripting.
    • File format: Text-based, TSV with a header or "key: value"
  • GNU Recutils
    • Description: "[A] set of tools and libraries to access human-editable, plain text databases called recfiles."
    • File format: Text-based, roughly "key: value"
  • SDB
    • Description: "[A] simple string key/value database based on djb's cdb disk storage and supports JSON and arrays introspection."
    • File format: Binary
  • sqlite3(1)
    • Description: "[A] simple command-line utility [...] that allows the user to manually enter and execute SQL statements against an SQLite database."
    • File format: Binary

License

The contents of this document is licensed under the Creative Commons Attribution 4.0 International License. By contributing you agree to release your contribution under this license.

Disclosure

csv2html, hosts, Sqawk, jsonwatch, Remarshal, and initool are developed by the curator of this document.

More Repositories

1

automatic-api

A list of software that turns your database into a REST/GraphQL API
Go
1,988
star
2

classless-css

A list of classless CSS themes/frameworks with screenshots
HTML
1,928
star
3

embedded-scripting-languages

A list of embedded scripting languages
1,277
star
4

compilers-targeting-c

A list of compilers that can generate C code
JavaScript
692
star
5

sqawk

Like awk but with SQL and table joins
Tcl
310
star
6

liveviews

Phoenix LiveView workalikes for different languages and frameworks
243
star
7

hicolor

🎨 Convert images to 15/16-bit RGB color with dithering
C
194
star
8

jsonwatch

Track changes in JSON data from the command line
Rust
165
star
9

unflattener

Make normal maps for 2D art
Python
146
star
10

s2png

Store any data in PNG images
Rust
99
star
11

csv2html

Convert CSV files to HTML tables
Rust
73
star
12

initool

Manipulate INI files from the command line
Standard ML
57
star
13

caddy-markdown-site

Serve Markdown files as HTML pages with CSS using just Caddy
CSS
52
star
14

picol

(Fossil repository mirror) A tiny interpreter
C
32
star
15

jimhttp

A library collection and web microframework
Tcl
28
star
16

tcl-duktape

Tcl bindings for Duktape, an embedded JavaScript interpreter
C
19
star
17

all-caps-basic

(WIP) A compiler written in Awk
Awk
16
star
18

caddy-cgi

An example of how to configure Caddy 1/2 with a FastCGI-to-CGI proxy
Perl
11
star
19

tinyfts

Very small standalone full-text search HTTP/SCGI server
Tcl
10
star
20

messagebox

Display message boxes from Windows batch files and command line programs
Shell
8
star
21

jimsh-static

Jim Tcl static binaries with SQLite 3 for Linux
Dockerfile
7
star
22

tcl-fcgi

FastCGI in pure Tcl
Tcl
6
star
23

2048.tcl

The game of 2048 implemented in Tcl
Tcl
4
star
24

pip-wtenv

Make your script download its dependecies; like pip.wtf but uses venvs
Python
4
star
25

joker-cgi-guestbook

A toy old-school CGI guestbook written in Joker
Clojure
3
star
26

HTMLgen

This is a mirror of the HTMLgen module by Robin Friedrich with the Debian patches
Python
3
star
27

ptjd

A pure Tcl JPEG decoder
Tcl
2
star
28

gpgedit

Edit symmetrically encrypted files
Tcl
2
star
29

fossil-wiki-export

Export a Fossil SCM wiki to Git preserving the revision history
Tcl
2
star
30

circleci-tcl-gcc-autoconf

Docker image for testing Tcl and C code with CircleCI
Dockerfile
2
star
31

klisp

C
2
star
32

empty

(Mirror) An alternative to Expect for *nix shells
C
1
star
33

caddy-deb-opt

Build a deb package to install Caddy in /opt/
Makefile
1
star
34

apache-2.4-webdav

A WebDAV file share/inbox configuration example for Apache 2.4
CSS
1
star
35

tcl86-nsis-installer

Build a Windows installer for Tcl with NSIS
PowerShell
1
star
36

tcl-augeas

Tcl bindings for Augeas
C
1
star