#!/bin/sh set -eu if [ "$#" -lt 1 ] || [ "$#" -gt 2 ]; then printf 'Usage: %s INPUT.csv [OUTPUT.csv]\n' "$0" >&2 exit 2 fi input=$1 output=${2:--} process_csv() { awk -F '\",\"' ' BEGIN { OFS = FS } { sub(/\r$/, "", $0) } NR == 1 { print next } { if ($5 == "- -") { $5 = "" } print } ' "$input" } if [ "$output" = "-" ]; then process_csv else process_csv > "$output" fi