fixes
This commit is contained in:
42
prod_data_parse_scripts/parse_prijem_vydaj.sh
Executable file
42
prod_data_parse_scripts/parse_prijem_vydaj.sh
Executable file
@@ -0,0 +1,42 @@
|
||||
#!/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
|
||||
Reference in New Issue
Block a user