From owner-freebsd-questions Fri Feb 1 12:24:48 2002 Delivered-To: freebsd-questions@freebsd.org Received: from hawk.mail.pas.earthlink.net (hawk.mail.pas.earthlink.net [207.217.120.22]) by hub.freebsd.org (Postfix) with ESMTP id DA1CF37B400 for ; Fri, 1 Feb 2002 12:24:43 -0800 (PST) Received: from dialup-166.90.86.172.dial1.chicago1.level3.net ([166.90.86.172] helo=earthlink.net) by hawk.prod.itd.earthlink.net with esmtp (Exim 3.33 #1) id 16WkEh-0004xo-00; Fri, 01 Feb 2002 12:24:40 -0800 Message-ID: <3C5AF989.80DCFEBB@earthlink.net> Date: Fri, 01 Feb 2002 14:24:41 -0600 From: Bob X-Mailer: Mozilla 4.51 [en] (X11; I; FreeBSD 4.4-RELEASE i386) X-Accept-Language: en MIME-Version: 1.0 To: adrian kok Cc: cjclark@alum.mit.edu, freebsd-questions@FreeBSD.ORG Subject: Re: help about awk References: <20020201194711.53260.qmail@web21206.mail.yahoo.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG You're asking an awful lot of questions that are basic, UNIX scripting how-to stuff. You should consider reading a basic shell programming book. You'd save a lot of time -- sooner than you may think. In answer to your question, just pipe your date into: awk -F: '{print $1}' If you're really pressed for time, you should, at least, read the "sed" and "awk" man pages if you need to manipulate a lot of text files. O'Reilly sells a good book on sed & awk, too. (Perl is slicker in some ways, but I wouldn't worry about that until I had a better grip on the more widely-used tools (such as sh, sed, awk...).) - Bob adrian kok wrote: > > Many thanks for help > > I would like to ask one more question > > How do I get the first column data without : > > adrian: math > john: eng > paul: music > > Output --> > adrian > john > paul > > Thank you again > > --- "Crist J. Clark" wrote: > > On Sat, Feb 02, 2002 at 01:05:53AM +0800, adrian kok > > wrote: > > > Hi all > > > > > > Could you teach me how to get (data1, data2) from > > the > > > following pattern? > > > > > > > > > > > > mail home (100,00,000,'1111-2','89','data1'); > > > email home1 (200,01,001,'1112-2','80','data2'); > > > > > > > > > > > > > > > awk '{print $3}' -> > > > (100,00,000,'1111-2','89','data1'); > > > > > > > > > But I only need data1 without ' ' eg the output > > > > > > data1 > > > data2 > > > data3 > > > data4 > > > > awk -F\' '{ print $6; }' > > > > -- > > Crist J. Clark | > > cjclark@alum.mit.edu > > | > > cjclark@jhu.edu > > http://people.freebsd.org/~cjc/ | > cjc@freebsd.org > > _______________________________________________________________________ > Do You Yahoo!? > Get your free @yahoo.com.hk address at http://mail.english.yahoo.com.hk > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-questions" in the body of the message To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message