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

scripting question: to parse data with varname=value pattern the easiest way?



 Hello.

A program output is like this:

result_01: a="23" b="288" c="A_string" ac="34"
result_02: a="23" b="28" c="A_string_too" dc="3"
....


I am writing a script to output values of b if b is in the result set.

It would be rather easy to match value of with regular expression:

/b="([^"]*)"/ # \1 would be the value of b.

Out of curiosity I just wonder is there an alternative way? One came to
my mind is to replace result_* with an invoke of awk, then the
name=value pattern become parameter of awk, then I can simply do '{print
$b;}' to get value of b. I tried that without success.



Reply to: