Former-commit-id:133dc97f67
[formerlya02aeb236c
] [formerly9f19e3f712
] [formerly133dc97f67
[formerlya02aeb236c
] [formerly9f19e3f712
] [formerly06a8b51d6d
[formerly9f19e3f712
[formerly 64fa9254b946eae7e61bbc3f513b7c3696c4f54f]]]] Former-commit-id:06a8b51d6d
Former-commit-id:9bb8decbcf
[formerly8e80217e59
] [formerly377dcd10b9
[formerly3360eb6c5f
]] Former-commit-id:377dcd10b9
Former-commit-id:e2ecdcfe33
36 lines
1.3 KiB
Bash
36 lines
1.3 KiB
Bash
#!/bin/bash
|
|
# This script updates xxxid entries in the stdtextproducts table.
|
|
# It takes xxxid entries that are 2 characters and pads them to 3
|
|
# by adding a trailing space.
|
|
#
|
|
# This needs to be performed with build 11.9.0-1 where all xxxid
|
|
# entries that are inserted and queried for must be 3 characters.
|
|
#
|
|
# Set up
|
|
# 1) Perform this task on the machine with the edex database
|
|
# 2) create a directory where you have read write permissions
|
|
# 3) cd to the directory
|
|
# 4) Copy this file (update_stdtextproducts.sh) to this directory
|
|
# 5) do: chmod +x update_stdtextproducts.sh
|
|
# 6) ./update_stdtextproducts.sh
|
|
|
|
export DEFAULT_HOST=${DEFAULT_HOST:-localhost}
|
|
psql=/awips2/psql/bin/psql
|
|
dq='"'
|
|
selCmd="select distinct xxxid from stdtextproducts where length(xxxid) = 2 ;"
|
|
|
|
rm -f ./tmp.sql
|
|
${psql} -h ${DEFAULT_HOST} -U awips -d fxatext -c "${selCmd}" | \
|
|
sed -n -e '/^ \(..\)$/s//UPDATE stdtextproducts set xxxid="\1 " where xxxid="\1";/p' \
|
|
-e '/^ \(.\)$/s//UPDATE stdtextproducts set xxxid="\1 " where xxxid="\1";/p' \
|
|
-e '/^$/s//UPDATE stdtextproducts set xxxid=" " where length(xxxid) = 0 ;/p' | \
|
|
sed -e"s/$dq/'/g" > ./tmp.sql
|
|
|
|
cat ./tmp.sql
|
|
|
|
echo ""
|
|
echo "Press Enter to perform the updates Ctrl-C to quit."
|
|
read done
|
|
|
|
${psql} -h ${DEFAULT_HOST} -U awips -d fxatext < ./tmp.sql
|
|
rm -f ./tmp.sql
|