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

Re: quick scripting question - finding occurrence in many lines



On Mon, 2006-11-06 at 01:10 +1100, John O'Hagan wrote:

> Or the whole thing could even be done with (I think!):
> 
> #tr -d '\n' < IN | tr ' ' '\n' | grep -B1 Processor | grep -v 'Processor\|--'
> 
> i.e., remove the newlines, replace all the spaces with newlines, then grep for 
> the line before "Processor".
>  


Okay, I mis-described my problem. It may have any number (>0) of spaces
between the fields eg


blah bals 38 Pro
    cessor

or

bnd c cds sd dcs sd  38
    Processor

ta, Michael

PS: ta for the intro to 'tr'!



Reply to: