FZF script for searching a lookup table

2020-06-15

I have a very long lookup table which corrects synonymy in species names.

The table is a .csv with the original name in the first column and the corrected name in the second column.

I wrote a shell script which uses fzf to search the table and outputs the corrected name:

#!/usr/bin/env sh 

csv=$(csvcut -c "${2}","${3}" "${1}" | sed 's/,/ -- /g' | tail -n +2)

echo "${csv}" | fzf | sed 's/.*--\ //'
fzf_csv test.csv orig corr