파일에서 줄 제거

파일에서 줄 제거

내 출력 파일에는 필요한 출력과 함께 아래 줄이 여러 번 포함되어 있습니다.

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 '!/^WARN/' filename

sed:

sed '/^WARN/d' filename

그렙:

grep -v '^WARN' filename

관련 정보