Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 01 Feb 2002 14:24:41 -0600
From:      Bob <BobGiesen@earthlink.net>
To:        adrian kok <adriankok2000@yahoo.com.hk>
Cc:        cjclark@alum.mit.edu, freebsd-questions@FreeBSD.ORG
Subject:   Re: help about awk
Message-ID:  <3C5AF989.80DCFEBB@earthlink.net>
References:  <20020201194711.53260.qmail@web21206.mail.yahoo.com>

next in thread | previous in thread | raw e-mail | index | archive | help
   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" <cristjc@earthlink.net> 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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3C5AF989.80DCFEBB>