Hi Gerrit,
If you do not set your InTerminator to the normal line terminator for this
protocol (i.e. inside the { } ), then the 'in' command will read all the lines
(terminated by readTimeout). If there is a "special" terminator after reply
(e.g. 2 newlines) even better: Set InTerminator accordingly.
Now you can parse for your unique identifier with a regex search.
ExtraInput=ignore;
in "%/unique identifier[^\n]*/";
This should give you the matching line (as a string).
or
in "%.1/unique identifier/([\n]*)";
should give you everything after the the identifier.
To read a number after the identifier:
in "%*/unique identifier/%f)";
Or several numbers:
in "%*/unique identifier/%(\$1:rec1)f,%(\$1:rec1)f,%f";
%/regex/ searches the a match (skipping everything before) and returns the
match. %.n/regex/ returns the match for the n-th () in the regex.
%*/regex/ skips the match (returns nothing) and lets you continue parsing for
data right after the match.
Give example data for more details (so that I do not have to guess).
Dirk
On Fri, 2023-10-13 at 14:15 +0200, Gerrit Kühn via Tech-talk wrote:
> Hello,
>
> I have a couple of devices on a bus. I can get a list of the devices and
> their properties using an enumeration call. I am interested in some of
> these properties and the answer line for a particular device would be easy
> to parse with streamdevice. However, the answer for the whole bus consists
> of several of these lines while I am only looking for one (and I know how
> it starts, containing an unique device identifier).
> Is there some way to do this with streamdevice or to I need a different
> approach? I cannot use the recommended solution from the "Tips&Tricks"
> section of the manual and use multiple IN-statements as I do neither know
> how many of these there will be, nor the number of the one I am looking
> for.
>
>
> cu
> Gerrit
- Replies:
- Re: process multiple lines with streamdevice Gerrit Kühn via Tech-talk
- References:
- process multiple lines with streamdevice Gerrit Kühn via Tech-talk
- Navigate by Date:
- Prev:
process multiple lines with streamdevice Gerrit Kühn via Tech-talk
- Next:
Re: process multiple lines with streamdevice Gerrit Kühn via Tech-talk
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
<2023>
2024
- Navigate by Thread:
- Prev:
process multiple lines with streamdevice Gerrit Kühn via Tech-talk
- Next:
Re: process multiple lines with streamdevice Gerrit Kühn via Tech-talk
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
<2023>
2024
|