我写了一个sql查询,它会为我获得一些输出。以下是代码:
sqlplus -s user/passwd@DB << EOF > /dev/null 2>&1
set heading off
set feedback off
set verify off
set pagesize 50000
set trimspool on
set wrap off
set linesize 2000
spool /home/sql_test.txt;
select /*+parallel(a,4)*/ substr(dati, 1, 11), substr(dati, 13, 500)
from ferdquatadm.tmp_fq_migration a, account b, customer_node_history c
where substr(dati, 1, 11) = account_name
and b.customer_node_id = c.customer_node_id
and sysdate between effective_start_date and effective_end_date
and schedule_id = 1234;
spool off;
exit
EOF
sed '1d' sql_test.txt > sqltest_1.txt
mv sqltest_1.txt my_code_123.txt
rm -rf sql_test.txt
但我想要输出如下:
23554400043 0117601738;22TU003719388001V;
23554402883 0823973229;TTT0823973229001C;
23554402950 024071080;MNT024071080001D;
23554405827 0415260614;TL20415260614001R;
23554405828 08119270800;TL2U003010407001G;
23554406553 011306895;VBT011306895001E;
23554406557 054121509;TL2054121509001M;
我得到的输出如下:
23554402243 0584940772;2TZ0584940772001U;
23554402272 0423721840;7TT0423721840001B;
23554402303 0110770863;BBTU500248822001Q;
23554402305 02311301;BTB02311301001J;
23554402563 0550503408;PPTU004984208001O;
23554402605 0457553223;Q0T0457553223001I;
我想删除输出中两列之间的额外空格。