I have a config file thus:
a: 123 b: abc device: 1000 c: xyz [old] a: 120 b: xyz device: 200 c: abc
The section "[old]" and everything below it is not always present.
How do I determine if the text "device: 1000" exists in the file BEFORE an optional "[old]" section?
I have been messing around with the following (broken) command syntax and I can't get it to do what I need...
sed -e '0,/^\[/; /device: /p' configfile ; echo $?
0,/^\[/ was supposed to limit the search between the start of the file and the first occurrence of "[" in the first column. I am trying to get the return code to indicate whether the string was found or not.