awips2/deltaScripts/19.1.1/DR7278/padXXXID.sh

19 lines
653 B
Bash
Raw Normal View History

2022-05-05 12:34:50 -05:00
#! /bin/bash
#
# This script will right pad any xxxid entries with spaces
# if they are less than 3 characters long, if a padded entry
# does not already exist
#
# right pad all short xxxid entries if one doesn't already exist
/awips2/psql/bin/psql -U awips -d fxatext -c "
INSERT INTO public.textproductinfo (cccid, nnnid, xxxid, versionstokeep)
(SELECT cccid, nnnid, rpad(xxxid,3), versionstokeep
FROM public.textproductinfo WHERE length(xxxid) < 3)
ON CONFLICT DO NOTHING;
"
# delete all records with short xxxid entries
/awips2/psql/bin/psql -U awips -d fxatext -c "
DELETE FROM public.textproductinfo WHERE length(xxxid) < 3;
"