On Fri, 2006-11-03 at 13:32 -0800, Aleksei Dzhulai wrote:
> The simplest case:
> awk '{for (i=1;i<=NF;i++) {if ($i~/Processor/) print $(i-1)} }' file
>
This doesn't work at all for me. Given the file:
BOF
junk info 18 Pro
cessor
EOF
It produces no output.
I think this should do what you want.
awk -v RS='' '{gsub("\n", ""); split($0, parts); for (x in parts) if (parts[x]~/Processor/) print parts[x-1]}'
-davidc
--
gpg-key: http://www.zettazebra.com/files/key.gpg
Attachment:
signature.asc
Description: This is a digitally signed message part