From owner-freebsd-newbies Tue Jan 11 14:25: 9 2000 Delivered-To: freebsd-newbies@freebsd.org Received: from mx2.x-treme.gr (mx2.x-treme.gr [212.120.192.15]) by hub.freebsd.org (Postfix) with ESMTP id 0FEB6150FF for ; Tue, 11 Jan 2000 14:25:01 -0800 (PST) (envelope-from keramida@diogenis.ceid.upatras.gr) Received: from localhost.hell.gr (pat28.x-treme.gr [212.120.197.220]) by mx2.x-treme.gr (8.9.3/8.9.3/IPNG-ADV-ANTISPAM-0.1) with SMTP id AAA23411 for ; Wed, 12 Jan 2000 00:24:47 +0200 Received: (qmail 65777 invoked by uid 1001); 11 Jan 2000 16:29:44 -0000 Date: Tue, 11 Jan 2000 18:29:44 +0200 From: Giorgos Keramidas To: SIVARAM N Cc: freebsd-newbies@FreeBSD.ORG Subject: Re: awk/gawk question Message-ID: <20000111182944.B64680@hades.hell.gr> Reply-To: keramida@ceid.upatras.gr References: <006a01bf5c11$6bdb5940$8b2fa8c0@wipsys.ge.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0pre3i In-Reply-To: <006a01bf5c11$6bdb5940$8b2fa8c0@wipsys.ge.com> Sender: owner-freebsd-newbies@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org On Tue, Jan 11, 2000 at 02:24:07PM +0530, SIVARAM N wrote: > Hi, > > If I have a record(s) with the word "DESC" anywhere within it, > How do i extract all chars upto the word "DESC" and all the chars after > "DESC" till the end of the line/record separately. > > like for e.g > DESC : audit file > ADEIN DESC : file from ADE If you want to use DESC as the separator of records, you can always change FS in awk to achieve it. $ cat desc.awk BEGIN { FS = "DESC"; } { print NF,":",$1,"/",$2; } $ cat < "What we have to learn to do, we learn by doing." [Aristotle] To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-newbies" in the body of the message