i want to call a shell scripts which has sed command in it to format the xyz.csv generated by this shell. SED gets unrecognised in this code
Advertisement
Answer
You can’t use sed
inside sqlplus
. So add this command after the EOF
marker. Ans also use the variable for input filename
JavaScript
x
#!/bin/bash
FILE="xyz.csv"
sqlplus -s ---sqlconnection-- <<EOF
set pagesize 50000
set linesize 32767
set head on
set underline off
set trimspool on
set colsep '|'
set feedback off
set trims on
set trim on
set wrap off
set newpage none
set trimout on
COLUMN a FORMAT A20
COLUMN b FORMAT A20
COLUMN C FORMAT A20
COLUMN d
COLUMN e FORMAT
SPOOL $FILE
select * from xyz;
SPOOL OFF
SET TERMOUT on
EXIT
EOF
sed 's/ *| */|/g' $FILE >> output.csv