I have an options file of the following format
option1 = value1
option2 = value2
..... ; variable number of options
.....
page_size= pagesize1 ;Note there is no space between page_size and =
page_size= pagesize2
page_size= pagesize3
During a regression test I want to extract the values for these options. Since the keywords "option1", option2, ... are different from each other, I can use awk to extract the values of value1, value2 as follows.
value1=$(awk '/option1/ {print $3}' $optfile)
value2=$(awk '/option2/ {print $3}' $optfile)
Now the problem is with the values for page_size. Although there can be multiple values for page_size, the following statement of awk
pagesize1=$(awk '/ page_size=/ {print $2}' $optfile)
gives me only the corresponding value for the first match of page_size.
So do any of you know of a way to get all three page sizes using awk?
Thanks.