awk删除包含字符串的文本块

时间:2014-01-29 03:10:36

标签: gawk

我有一个文本块,文本块用空行分隔。如果包含字符串,我想删除整个文本块。

以下工作正常,但它将生成的文件保留为gawk 3.1.8中的二进制文件。而在 gawk 4.1.0 它可以正常工作。我错过了什么?

awk -vRS= '$0!~/'$exc'/{print $0RT}' $SDIR/PACKAGES.TXT > $SDIR/PACKAGES2.TXT

代码只能在slackware上运行。以下是文本文件的示例。

PACKAGE NAME:  gv-3.7.3-i486-2.txz
PACKAGE LOCATION:  ./slackware/xap
PACKAGE SIZE (compressed):  196 K
PACKAGE SIZE (uncompressed):  590 K
PACKAGE DESCRIPTION:
gv: gv (PS/PDF file viewer)
gv:
gv: gv is a PostScript and PDF previewer.  It allows users to view and
gv: navigate through PostScript and PDF documents on an X display by 
gv: providing a user interface for the ghostscript interpreter.
gv:
gv: gv was written by Johannes Plass, using the source code for Tim
gv: Theisen's ghostview 1.5 as a starting point.
gv:


PACKAGE NAME:  gvfs-1.12.3-i486-2.txz
PACKAGE LOCATION:  ./slackware/l
PACKAGE SIZE (compressed):  1096 K
PACKAGE SIZE (uncompressed):  7100 K
PACKAGE DESCRIPTION:
gvfs: gvfs (glib virtual filesystems)
gvfs:
gvfs: gvfs is a userspace virtual filesystem designed to work with the I/O
gvfs: abstractions of libgio (a library included in the glib2 package).
gvfs: It installs several modules that are automatically used by applications
gvfs: that use the libgio API.  There is also fuse support that allows
gvfs: applications not using gio to access the gvfs filesystems.
gvfs:

0 个答案:

没有答案