Text manipulation toolkit for Unix pipelines.
brew tap sanohiro/txtk
brew install txtkConvert between naming conventions.
echo "hello_world" | kase camel # helloWorld
echo "helloWorld" | kase snake # hello_world
echo "hello world" | kase kebab # hello-world
echo "hello_world" | kase pascal # HelloWorld
echo "hello_world" | kase upper # HELLO_WORLD
echo "HELLO_WORLD" | kase lower # hello_world
echo "hello world" | kase title # Hello WorldSubcommands: snake, camel, pascal, kebab, upper, lower, title
Encode and decode various formats.
echo "hello world" | enco url # hello%20world
echo "hello%20world" | enco url -d # hello world
echo "<div>" | enco html # <div>
echo "<div>" | enco html -d # <div>Subcommands: url, html
Options: -d, --decode - Decode mode (default is encode)
Convert between JSON, YAML, and TOML.
echo '{"name":"john"}' | fcnv yaml # name: john
echo 'name: john' | fcnv json # {"name":"john"}
echo 'name = "john"' | fcnv json # {"name":"john"}
echo '{"a":1}' | fcnv json -p # Pretty print
echo -e '{\n "a": 1\n}' | fcnv json -c # CompactSubcommands: json, yaml, toml
Options: -p, --pretty / -c, --compact (JSON only)
Compress consecutive characters.
echo "a b c" | sqz # a b c
echo -e "a\n\n\nb" | sqz -n # a\nb
echo "aaabbbccc" | sqz -c a # abbbccc
echo "aaabbbccc" | sqz -a # abcOptions: -n, --newlines, -t, --tabs, -c, --char <CHAR>, -a, --all
Convert between fullwidth/halfwidth and hiragana/katakana.
echo "ABC123" | zen half # ABC123
echo "ABC123" | zen full # ABC123
echo "ひらがな" | zen kata # ヒラガナ
echo "カタカナ" | zen hira # かたかな
echo "カタカナ" | zen full --kana # カタカナSubcommands: half, full, kata, hira
Options: -k, --kana - Also convert kana characters (half/full only)
MIT