Fields


Field numbering

AWK and cut commands need field numbers from your TSV. To get those numbers in a terminal, use the fields function. It takes filename as its one argument and prints a 2-column, numbered list of fields. Long fieldnames may be truncated. In the screenshot below, there are 30 Darwin Core fields in the table "oc1":

fields()
{
head -n 1 "$1" | tr '\t' '\n' | pr -t -2 -n
}

fields function

A graphical alternative to fields is the fieldlist function. It uses a YAD dialog to create a persistent window just to one side of the terminal with a scrollable, numbered list of fields. You will probably need to adjust the --geometry values in the YAD command to suit your display. The YAD window is in a background process. To close fieldlist, bring the process to the foreground with fg and exit with Ctrl+c.

fieldlist()
{
head -1 "$1" | tr '\t' '\n' | nl | yad --geometry=350x800+1450+100 --text-info --no-focus &
}

fieldlist function


Fieldnames

Make sure your Darwin Core fieldnames are correctly spelled and formatted by referring to the online list of terms. While decimalLatitude, DecimalLatitude and latitudeDecimal are all good names for a field with latitudes in decimal degrees, only the first one is correct for Darwin Core.

Similarly, recordEnteredBy is a useful field in a Symbiota database. However, it isn't a Darwin Core field. A better place for supplementary information is the Darwin Core dynamicProperties field.