在我的輸出檔案中,我多次包含以下行以及所需的輸出。
WARN: The method class org.apache.commons.logging.impl.SLF4JLogFactory#release() was invoked.
WARN: Please see http://www.slf4j.org/codes.html#release for an explanation.
這是我的輸出的樣子。
####################################################################
Raw Error: count of the error records with latest trans session in "audit_preatlas_wb4370_raw_error_05012016073248" table
====================================================================
count trans_session
WARN: The method class org.apache.commons.logging.impl.SLF4JLogFactory#release() was invoked.
WARN: Please see http://www.slf4j.org/codes.html#release for an explanation.
********************************************************************
Raw Audit: Total records available in "audit_preatlas_wb4370_raw_audit_05012016073248" table
====================================================================
count trans_session
Raw Audit: Distinct records of "audit_preatlas_wb4370_raw_audit_05012016073248" table
====================================================================
count trans_session
WARN: The method class org.apache.commons.logging.impl.SLF4JLogFactory#release() was invoked.
WARN: Please see http://www.slf4j.org/codes.html#release for an explanation.
Raw Audit : count of duns with error "gbwr_raw_audit_mandatory_field" code in "audit_preatlas_wb4370_raw_audit_05012016073248" table
====================================================================
count trans_session error_code
WARN: The method class org.apache.commons.logging.impl.SLF4JLogFactory#release() was invoked.
WARN: Please see http://www.slf4j.org/codes.html#release for an explanation.
Raw Audit : count of duns with error "gbwr_raw_audit_numeric_field" code in "audit_preatlas_wb4370_raw_audit_05012016073248" table
====================================================================
count trans_session error_code
WARN: The method class org.apache.commons.logging.impl.SLF4JLogFactory#release() was invoked.
WARN: Please see http://www.slf4j.org/codes.html#release for an explanation.
如何單獨刪除 WARN 行?
答案1
所以有幾種方法。要總結上述評論,您可以執行以下操作之一:
awk:
awk '!/^WARN/' filename
sed:
sed '/^WARN/d' filename
格列普:
grep -v '^WARN' filename