>>Script Language and Platform: Bash – Sed
This well-tested bash script is used to transfer data from
Informix to PostgreSQL. Copy and paste the script into an
sqlparser.sh file and make it executable. (Only works in UNIX).
Author: Vasilis Ventirozos
sqlparser File Table
Script Code: #!/bin/bash
if test $# -ne 2
then echo “usage: sqlparser <File> <Table>”
exit;
fi
echo “COPY “$2″ FROM stdin;” >$1.pg
cat $1|sed ”s/|$//” | sed ”s/,/./g”
|sed -e ”s/|/ /g” >>$1.pg
echo “.” >>$1.pg
echo “”
echo “Transform Complete to upload run cat $1.pg |psql <SERVER>”
echo “”
Disclaimer: We hope that the information on these script pages is
valuable to you. Your use of the information contained in these pages,
however, is at your sole risk. All information on these pages is provided
“as -is”, without any warranty, whether express or implied, of its accuracy,
completeness, or fitness for a particular purpose…
Disclaimer Continued
Back to Database Journal Home