haskell-awk alternatives and similar packages
Based on the "Console" category.
Alternatively, view haskell-awk alternatives based on common mentions on social networks and blogs.
-
hledger
Robust, fast, intuitive plain text accounting tool with CLI, TUI and web interfaces. -
hledger-flow
An hledger/ledger-cli workflow focusing on automated statement import and classification -
docopt
A command-line interface description language and parser that will make you smile -
hledger-iadd
A terminal UI as drop-in replacement for hledger add. -
hflags
Command line flag parser for Haskell, conceptually very similar to Google's gflags -
hledger-stockquotes
Generate an HLedger Journal Containing Daily Stock & Crypto Quotes for your Commodities -
spelling-suggest
spelling suggestion library and command line tool -
husky
husky is a command line shell for UNIX-like OS written in haskell. -
print-console-colors
Print all the ANSI console colors for your terminal -
pasty
pasty is a linux command line tool written in Haskell for pasting from column centric plain text files. -
uniq-deep
alternative of unix uniq command. 'uniq-deep' detect repeated lines unless they are adjacent. -
structured-cli
Application library for building interactive console CLIs -
hledger-makeitso
An hledger workflow focusing on automated statement import and classification. -
cmdtheline
Declarative command-line option parsing and documentation library.
Updating dependencies is time-consuming.
Do you think we are missing an alternative of haskell-awk or a related project?
README
Hawk 
Transform text from the command-line using Haskell expressions. Similar to awk, but using Haskell as the text-processing language.
Examples
In Unix the file /etc/passwd
is used to
keep track of every registered user in the system. Each entry in the file
contains information about a single user, using a simple colon-separated format.
For example:
root:x:0:0:root:/root:/bin/bash
The first field is the username. We can use Hawk to list all usernames as follows:
> cat /etc/passwd | hawk -d: -m 'head'
root
The -d
option tells Hawk to use :
as field delimiters, causing the first line to be interpreted as ["root", "x", "0", "0", "root", "/root", "/bin/bash"]
.
The -m
tells Hawk to map a function over each line of the input. In this case, the function head
extracts the first field of the line, which happens to be the username.
We could of course have achieved identical results by using awk instead of Hawk:
> cat /etc/passwd | awk -F: '{print $1}'
root
While Hawk and awk have similar use cases, the philosophy behind the two is very different. Awk uses a specialized language designed to concisely express many text transformations, while Hawk uses the general-purpose language Haskell, which is also known for being concise, among other things. There are many standard command-line tools that can be easily approximated using short Haskell expressions.
Another important difference is that while awk one-liners are self-contained, Hawk encourages the use of libraries and user-defined functions. By adding function definitions, module imports and language pragmas to Hawk's user-configurable prelude file, those functions, libraries and language extensions become available to Hawk one-liners.
For instance, we could add a takeLast
function extracting the last n
elements from a list, and use it to (inefficiently) approximate tail
:
> echo 'takeLast n = reverse . take n . reverse' >> ~/.hawk/prelude.hs
> seq 0 100 | hawk -a 'takeLast 3'
98
99
100
For more details, see the presentation and the [documentation](doc/README.md).
Installation
To install hawk, clone this repository, run stack install
, and add ~/.local/bin
to your PATH. Alternatively, you can also use cabal, but only v1-style is currently supported: run cabal v1-sandbox init && cabal v1-install
, and add /.../.cabal-sandbox/bin
to your PATH.
You should be ready to use Hawk:
> hawk '[1..3]'
1
2
3
The first run will create a default configuration file into
~/.hawk/prelude.hs
if it doesn't exist.