Skip to content

fumiyas/LTSV.sh

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Labeled Tab-Separated Value parser / manipulator for shell

What's this?

See http://ltsv.org/ and the following example:

#!/bin/bash
# or
#!/bin/ksh

. ./LTSV.sh

## Define a hash to store values
typeset -A hash
## Parse an LTSV in a string
LTSV_decode hash "foo:Foo	bar:Bar	baz:*baz*"
## Parse an LTSV read from STDIN
#LTSV_decode hash

echo "${hash[foo]}"
echo "${hash[bar]}"
echo "${hash[baz]}"

for key in "${!hash[@]}"; do
  echo "$key: ${hash[$key]}"
done

## Manipulate an LTSV from a hash
LTSV_encode hash

Requirements

  • bash or ksh (ksh93)

TODO

  • Add more test
  • Support zsh
  • LTSV_encode: Reject or escape TAB and CR character in values

About

Labeled Tab-Separated Value parser / manipulator for shell

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages