A string manipulation tool written in haskell.
smh aims to bring the power of optics into the command line. It provides a terse, domain specific language for various string manipulation tasks.
-
yay -S smh-bin
-
cabal install smh
-
Download the latest release
Refer to the building instructions in the docs.
smh 'words.if > len 3|get' < input_file
- display all words longer than 3 characterssmh 'words.[0]|over upper' "hello world"
- capitalize all wordssmh 'lines.if startsWith "*".%words.[2]|get' < input_file
- display the third word in lines that start with an asterisksmh 'atKey "b"|over to %el.sum' '{"a": 1, "b": [1, 2, 3, 4, 5]}'
- sum the values of a JSON array at the "b" key of a JSON object'%(words.if isNumber)|get' < input_file
- get all numbers in a file
Before contributing, visit the Contributing page in the docs.
- Haskell, for being an awesome language
- lens library authors, for inspiring this whole ordeal
- mkdocs team, for making an awesome static documentation site generator