[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: I need a command for get a piece of text



Thanks for your help my friend.

  Tha's what i was finding.

-----Original Message-----
From: Arend Meetsma <arend meetsma org>
To: enigma-list redhat com
Date: Wed, 4 Sep 2002 11:28:31 -0600 (MDT)
Subject: Re: I need a command for get a piece of text

> On Wed, 4 Sep 2002, Matthias Saou wrote:
> 
> > Once upon a time, Erith wrote :
> > 
> > > I need a command that can get a piece of text from a string, like
> the << 
> > > operator in c++ for de stringstream. 
> > > 
> > > Some thing like this:
> > > 
> > >  Ej:      command  "aaaaa bbbb cccc"
> > >  result:  "aaaaa"
> > > 
> > > 
> > > there is any in linux that can i use.  
> > 
> > I think the most basic way of doing this is with "cut -d ' ' -f 1",
> like :
> > 
> > echo "aaaaa bbbb cccc" | cut -d ' ' -f 1
> > 
> > (cut with delimiter space and field one)
> > 
> > But then you may want to have a look at "awk" which will let you do
> this
> > and much much more...
> 
> 
> That is what I was going to suggest:
> $ echo aaaa bbbb cccc |gawk '{print $1}'               
> aaaa
>  
> 
> if you need to have a different delimiter than the default space, you 
> can do that too:
> 
> $ echo "aaaa:bbbb:cccc" |gawk -F : '{print $1}'
> aaaa
>  
> 
> --
> Arend
> 
> 
> 
> 
> 
> _______________________________________________
> enigma-list mailing list
> enigma-list redhat com
> https://listman.redhat.com/mailman/listinfo/enigma-list






[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]