编辑
我有一个包含字符串行的文件
mediafire.com/?a6o37kfc7m68dri
注意:媒体火上的那个文件实际上是“logs.out”,当我上传它时,我刚刚将它重命名为logs.txt。
示例内容:(logs.out)
BIF in bif_init> login successful
BIF in dbInit> INFO: DB status:20,successful
BIF in dbInit> INFO: get the fileName need be query DB. Size(0)
BIF in dbInit> INFO: get the fileName need be query DB. Size(30)
BIF in modInit> INFO: modInit finished
BIF in setInputTag> set input tag value, name/value:ACCOUNT_NO/4302253
BIF in setInputTag> set input tag value, name/value:bill_ref_no/199863752
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/12904
BIF in setInputTag> set input tag value, name/value:TOTAL_DUE/12904
BIF in run> INFO: updateParameterValues finished
BIF in getFile> INFO: Feed file(/arbordata/feedfile/PS-M07-1205-20130807-20130911-201711-1-bif01.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/4302253
BIF in setInputTag> set input tag value, name/value:bill_ref_no/199863752
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/12904
BIF in setInputTag> set input tag value, name/value:TOTAL_DUE/12904
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=2813096,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=13415970,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 setInputTag> set input tag value, name/value:ACCOUNT_NO/2726650
BIF in setInputTag> set input tag value, name/value:bill_ref_no/190155402
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/164888
BIF in setInputTag> set input tag value, name/value:TOTAL_DUE/164888
BIF in run> INFO: updateParameterValues finished
BIF in getFile> INFO: Feed file(/arbordata/feedfile/PS-M02-1204-20130602-20130911-201711-1-bif01.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/2726650
BIF in setInputTag> set input tag value, name/value:bill_ref_no/190155402
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/164888
BIF in setInputTag> set input tag value, name/value:TOTAL_DUE/164888
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 setInputTag> set input tag value, name/value:ACCOUNT_NO/4302253
BIF in setInputTag> set input tag value, name/value:bill_ref_no/199863752
BIF in setInputTag> set input tag value, name/value:bill_ref_resets/1
BIF in setInputTag> set input tag value, name/value:ACCOUNT_NO/4302253
BIF in setInputTag> set input tag value, name/value:bill_ref_no/199863752
BIF in setInputTag> set input tag value, name/value:bill_ref_resets/1
BIF in setInputTag> set input tag value, name/value:ACCOUNT_NO/2726650
BIF in setInputTag> set input tag value, name/value:bill_ref_no/190155402
BIF in setInputTag> set input tag value, name/value:bill_ref_resets/1
BIF in setInputTag> set input tag value, name/value:ACCOUNT_NO/2726650
BIF in setInputTag> set input tag value, name/value:bill_ref_no/190155402
BIF in setInputTag> set input tag value, name/value:bill_ref_resets/1
我想将它输出到格式如下的文件中:(水平和管道分隔符)
BIF in setInputTag> set input tag value, name/value:ACCOUNT_NO/4302253|BIF in setInputTag> set input tag value, name/value:bill_ref_no/199863752|BIF in setInputTag> set input tag value, name/value:bill_ref_resets/1
BIF in setInputTag> set input tag value, name/value:ACCOUNT_NO/4302253|BIF in setInputTag> set input tag value, name/value:bill_ref_no/199863752|BIF in setInputTag> set input tag value, name/value:bill_ref_resets/1
BIF in setInputTag> set input tag value, name/value:ACCOUNT_NO/2726650|BIF in setInputTag> set input tag value, name/value:bill_ref_no/190155402|BIF in setInputTag> set input tag value, name/value:bill_ref_resets/1
BIF in setInputTag> set input tag value, name/value:ACCOUNT_NO/2726650|BIF in setInputTag> set input tag value, name/value:bill_ref_no/190155402|BIF in setInputTag> set input tag value, name/value:bill_ref_resets/1
请帮助我:(我想创建 .sh 文件,它将在 PuTTy 上运行
执行此代码时,它正在工作
sed -n -e '/value:ACCOUNT_NO/{N;N;s/..\n\(.\)/|\1/g;p;}' logs.out> OUPUT_logs.out
但当
sed -n -e '/value:ACCOUNT_NO/{N;N;s/..\n\(.\)/|\1/g;p;}' logs.out> OUPUT_logs.txt
每条记录之间都有“空白线”。