帮助.......仍然无法正常工作
我有一个文件包含字符串:
http://mediafire.com/?a6o37kfc7m68dri
部分内容:
BIF in setInputTag> set input tag value, name/value:ACCOUNT_NO/1746056
BIF in setInputTag> set input tag value, name/value:bill_ref_no/197546058
BIF in setInputTag> set input tag value, name/value:bill_ref_resets/1
BIF in setInputTag> set input tag value, name/value:DISPUTE_AMOUNT/0
BIF in setInputTag> set input tag value, name/value:NOD_FLAG/0
BIF in setInputTag> set input tag value, name/value:OUTSTANDING_BALANCE/510312
BIF in setInputTag> set input tag value, name/value:TOTAL_DUE/510312
BIF in addInheritedByField> INFO: Succeed to put the inherited value of field(BILLZIPCODE) into ACCT map
BIF in addInheritedByField> INFO: Succeed to put the inherited value of field(BILLEDACCOUNTNUMBER) into ACCT map
BIF in addInheritedByField> INFO: Succeed to put the inherited value of field(BILLNUMBER) into ACCT map
BIF in addInheritedByField> INFO: Succeed to put the inherited value of field(BILLNUMBERRESETS) into ACCT map
BIF in addInheritedByField> INFO: Succeed to put the inherited value of field(OWNINGACCOUNTNUMBER) into SI inherited_map
BIF in addInheritedByField> INFO: Succeed to put the inherited value of field(SUBSCRBNUMBER) into SI inherited_map
BIF in addInheritedByField> INFO: Succeed to put the inherited value of field(SUBSCRBNUMBERRESET) into SI inherited_map
BIF in addInheritedByField> INFO: Succeed to put the inherited value of field(DEFAULTEXTERNALID) into SI inherited_map
BIF in InvoiceRecord> INFO: Output data to SI map,successful. SI=10593131,0
BIF in addInheritedByField> INFO: Succeed to put the inherited value of field(OWNINGACCOUNTNUMBER) into SI inherited_map
BIF in addInheritedByField> INFO: Succeed to put the inherited value of field(SUBSCRBNUMBER) into SI inherited_map
BIF in addInheritedByField> INFO: Succeed to put the inherited value of field(SUBSCRBNUMBERRESET) into SI inherited_map
BIF in addInheritedByField> INFO: Succeed to put the inherited value of field(DEFAULTEXTERNALID) into SI inherited_map
BIF in InvoiceRecord> INFO: Output data to SI map,successful. SI=26203008,0
BIF in addInheritedByField> INFO: Succeed to put the inherited value of field(OWNINGACCOUNTNUMBER) into SI inherited_map
BIF in addInheritedByField> INFO: Succeed to put the inherited value of field(SUBSCRBNUMBER) into SI inherited_map
BIF in addInheritedByField> INFO: Succeed to put the inherited value of field(SUBSCRBNUMBERRESET) into SI inherited_map
BIF in addInheritedByField> INFO: Succeed to put the inherited value of field(DEFAULTEXTERNALID) into SI inherited_map
BIF in InvoiceRecord> INFO: Output data to SI map,successful. SI=57292633,0
BIF in addInheritedByField> INFO: Succeed to put the inherited value of field(OWNINGACCOUNTNUMBER) into SI inherited_map
BIF in addInheritedByField> INFO: Succeed to put the inherited value of field(SUBSCRBNUMBER) into SI inherited_map
BIF in addInheritedByField> INFO: Succeed to put the inherited value of field(SUBSCRBNUMBERRESET) into SI inherited_map
BIF in addInheritedByField> INFO: Succeed to put the inherited value of field(DEFAULTEXTERNALID) into SI inherited_map
BIF in InvoiceRecord> INFO: Output data to SI map,successful. SI=914416,0
BIF in addInheritedByField> INFO: Succeed to put the inherited value of field(OWNINGACCOUNTNUMBER) into SI inherited_map
BIF in addInheritedByField> INFO: Succeed to put the inherited value of field(SUBSCRBNUMBER) into SI inherited_map
BIF in addInheritedByField> INFO: Succeed to put the inherited value of field(SUBSCRBNUMBERRESET) into SI inherited_map
BIF in addInheritedByField> INFO: Succeed to put the inherited value of field(DEFAULTEXTERNALID) into SI inherited_map
BIF in InvoiceRecord> INFO: Output data to SI map,successful. SI=914415,0
BIF in addInheritedByField> INFO: Succeed to put the inherited value of field(OWNINGACCOUNTNUMBER) into SI inherited_map
BIF in addInheritedByField> INFO: Succeed to put the inherited value of field(SUBSCRBNUMBER) into SI inherited_map
BIF in addInheritedByField> INFO: Succeed to put the inherited value of field(SUBSCRBNUMBERRESET) into SI inherited_map
BIF in addInheritedByField> INFO: Succeed to put the inherited value of field(DEFAULTEXTERNALID) into SI inherited_map
BIF in InvoiceRecord> INFO: Output data to SI map,successful. SI=57292561,0
BIF in InvoiceRecord> INFO: Output data to SI map,successful. SI=914415,0
BIF in InvoiceRecord> INFO: Output data to SI map,successful. SI=914416,0
BIF in InvoiceRecord> INFO: Output data to SI map,successful. SI=10593131,0
BIF in InvoiceRecord> INFO: Output data to SI map,successful. SI=26203008,0
BIF in InvoiceRecord> INFO: Output data to SI map,successful. SI=57292561,0
BIF in InvoiceRecord> INFO: Output data to SI map,successful. SI=57292633,0
BIF in InvoiceRecord> INFO: Output data to SI map,successful. SI=914415,0
BIF in InvoiceRecord> INFO: Output data to SI map,successful. SI=57292561,0
BIF in InvoiceRecord> INFO: Output data to SI map,successful. SI=57292561,0
BIF in setInputTag> set input tag value, name/value:ACCOUNT_NO/1746056
BIF in setInputTag> set input tag value, name/value:bill_ref_no/202085235
BIF in setInputTag> set input tag value, name/value:bill_ref_resets/1
BIF in setInputTag> set input tag value, name/value:DISPUTE_AMOUNT/0
BIF in setInputTag> set input tag value, name/value:NOD_FLAG/0
BIF in setInputTag> set input tag value, name/value:OUTSTANDING_BALANCE/962908
BIF in setInputTag> set input tag value, name/value:TOTAL_DUE/962908
BIF in run> INFO: updateParameterValues finished
BIF in getFile> INFO: Feed file(/arbordata/feedfile/PS-M26-1104-20130726-20130911-201711-1-bif01-1.DAT) for current invoice
BIF in insertNewFile> m_pcurFileNameAttr->file_seq_no:(1)
BIF in insertNewFile> INFO:Output fileHeader(000020130911201711
) to feedfile,successful
BIF in setInputTag> set input tag value, name/value:ACCOUNT_NO/1746056
BIF in setInputTag> set input tag value, name/value:bill_ref_no/202085235
BIF in setInputTag> set input tag value, name/value:bill_ref_resets/1
BIF in setInputTag> set input tag value, name/value:DISPUTE_AMOUNT/0
BIF in setInputTag> set input tag value, name/value:NOD_FLAG/1
BIF in setInputTag> set input tag value, name/value:OUTSTANDING_BALANCE/962908
BIF in setInputTag> set input tag value, name/value:TOTAL_DUE/962908
BIF in addInheritedByField> INFO: Succeed to put the inherited value of field(BILLZIPCODE) into ACCT map
BIF in addInheritedByField> INFO: Succeed to put the inherited value of field(BILLEDACCOUNTNUMBER) into ACCT map
BIF in addInheritedByField> INFO: Succeed to put the inhelibarbor_db/database_gen.c(4670): arb_db_err - Entry
errtype = 2
exec_user_handler = 1
errcode = 1422
errtext = Error in execution of OCI function unused:
retcode = -1 (OCI_ERROR)
ORA-01422: exact fetch returns more than requested number of rows
ORA-06512: at "ARBOR.PROJ_CSA_PROC2", line 9
我的场景是我想创建一个 .sh 脚本,该脚本将从文件中获取所需的所有字符串并将其格式化,如下所示,最后将其输出到一个新文件:
编辑
1729030|192840714|1|1422|Error in execution of OCI function unused:
1746056|202085235|1|1422|Error in execution of OCI function unused:
809434|201632617|1|1422|Error in execution of OCI function unused:
6993375|202888775|1|1422|Error in execution of OCI function unused:
7453294|199851665|1|1422|Error in execution of OCI function unused:
在哪里:
- 第一栏:
BIF in setInputTag> set input tag value, name/value:ACCOUNT_NO/
1729030 - 第2栏:
BIF in setInputTag> set input tag value, name/value:bill_ref_no/
192840714 - 第 3 列:
BIF in setInputTag> set input tag value, name/value:bill_ref_resets/
1 - 第 4 栏:
errcode =
1422 - Column5:
errtext =
未使用的OCI函数执行错误:
编辑
终于我感觉离我的目标更近了
执行此代码后:
egrep -e 'ACCOUNT_NO|bill_ref_no|bill_ref_resets|errcode|errtext' logs.txt | awk 'c-->0;$0~s{if(b)for(c=b+1;c>1;c--)print r[(NR-c+1)%b];print;c=a}b{r[NR%b]=$0}' b=4 a=0 s='errtext'
(上同:断线) - 运行时将其放入 1 行:
egrep -e 'ACCOUNT_NO|bill_ref_no|bill_ref_resets|errcode|errtext' logs.txt
|awk 'c-->0;$0~s{if(b)for(c=b+1;c>1;c--)print r[(NR-c+1)%b];print;c=a}b{r[NR%b]=$0}'
b=4 a=0 s='errtext'
编辑
将这行代码添加到我之前的代码后:
| sed -e 's/=/:/' -e 's/^BIF.*://' -e 's=/=:=' -e 's/^ *//' -e 's/ *: /:/' | sed -e 's/ACCOUNT_NO://g' -e 's/bill_ref_no:/|/g' -e 's/bill_ref_resets:/|/g' -e 's/errcode:/|/g' -e 's/errtext:/|/g'
这是我现在的输出:
1729030
|192840714
|1
|1422
|Error in execution of OCI function unused:
1746056
|202085235
|1
|1422
|Error in execution of OCI function unused:
809434
|201632617
|1
|1422
|Error in execution of OCI function unused:
6993375
|202888775
|1
|1422
|Error in execution of OCI function unused:
7453294
|199851665
|1
|1422
|Error in execution of OCI function unused:
现在的最后一个问题是如何修剪换行符以在下面输出
它尝试添加此代码,但它不起作用:
| sed -e 's/\n//g;'
如何修剪那些新线?
所需的输出是:
1729030|192840714|1|1422|Error in execution of OCI function unused:
1746056|202085235|1|1422|Error in execution of OCI function unused:
809434|201632617|1|1422|Error in execution of OCI function unused:
6993375|202888775|1|1422|Error in execution of OCI function unused:
7453294|199851665|1|1422|Error in execution of OCI function unused:
我现在的完整代码:
egrep -e 'ACCOUNT_NO|bill_ref_no|bill_ref_resets|errcode|errtext' logs.txt | awk 'c-->0;$0~s{if(b)for(c=b+1;c>1;c--)print r[(NR-c+1)%b];print;c=a}b{r[NR%b]=$0}' b=4 a=0 s='errtext' | sed -e 's/=/:/' -e 's/^BIF.*://' -e 's=/=:=' -e 's/^ *//' -e 's/ *: /:/' | sed -e 's/ACCOUNT_NO://g' -e 's/bill_ref_no:/|/g' -e 's/bill_ref_resets:/|/g' -e 's/errcode:/|/g' -e 's/errtext:/|/g' | sed -e 's/\n//g;'