Created
June 1, 2024 13:49
-
-
Save ogaida/99d610a08af0093fa9fbf8b1c0619ed1 to your computer and use it in GitHub Desktop.
csv preview with fzf
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
file=$1 | |
iconv --from-code=ISO-8859-1 --to-code=UTF-8 $file | \ | |
mlr --icsv --ifs ';' --omd cat| \ | |
fzf -e -i --preview="echo {}|tr '|' '\n'" -m --bind ctrl-o:select-all | \ | |
awk -F'|' '{sum += $9}END{print sum}' | |
# requirements: mlr (miller), fzf (fuzzy finder), iconv (convert codesets) | |
# it filters lines from csv | |
# converts to markdown table | |
# by spressing ctrl-o it will select all matching lines | |
# at the end calculates the total of column 8 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment