Afficher un message
Vieux 26/05/2007, 15h34   #7
Bill Marcum
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Searching for a string and print next string

On Sat, 26 May 2007 07:32:32 -0500, Ed Morton
<morton@lsupcaemnt.com> wrote:
>
>
> Chris F.A. Johnson wrote:
>> On 2007-05-25, apogeusistemas@gmail.com wrote:
>>
>>>Please, how can I find a specified string and print the next string ?
>>>I need find pineapple string and print next string in the line.
>>>Ex:
>>>Solaris> cat file1
>>>The strawberry and the pineapple are delicious.
>>>Solaris> ./script
>>>are

>>
>>
>> awk 'sub( /.*pineapple /,"") { print $1 }' file1
>>
>>

>
> What if you were looking for "apple" and "pineapple" was in the input file?


You can use \< and \> to match word boundaries.


--
If life is merely a joke, the question still remains: for whose amusement?
  Réponse avec citation
 
Page generated in 0,06513 seconds with 9 queries