syntax question

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

syntax question

Christopher Barry

Hello everyone,

I want to use the substring keyword to return a part of a string that
starts at character 5, and goes to the end of the string. The strings
will be of variable length. Do I simply omit the second numeric
parameter to accomplish that? I can't find anything about this in the
man pages.

Thanks

--
Regards,
Christopher
_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users
Reply | Threaded
Open this post in threaded view
|

Re: syntax question

glenn.satchell
Hi Christopher

Here's what it says in the dhcp-eval man page

substring (data-expr, offset, length)

       The substring operator evaluates the data  expression  and
       returns  the  substring  of  the result of that evaluation
       that starts offset bytes from  the  beginning,  continuing
       for  length  bytes.   Offset  and  length are both numeric
       expressions.  If data-expr, offset or length  evaluate  to
       null,  then the result is also null.  If offset is greater
       than or equal to the length of the evaluated data, then  a
       zero-length data string is returned.  If length is greater
       then the remaining length  of  the  evaluated  data  after
       offset, then a data string containing all data from offset
       to the end of the evaluated data is returned.

So just make length be a number bigger than your string is ever likely to
be, eg 1000, or 10,000, or 1,000,000 say.

regards,
-glenn

On Sat, September 2, 2017 12:03 am, Christopher Barry wrote:

>
> Hello everyone,
>
> I want to use the substring keyword to return a part of a string that
> starts at character 5, and goes to the end of the string. The strings
> will be of variable length. Do I simply omit the second numeric
> parameter to accomplish that? I can't find anything about this in the
> man pages.
>
> Thanks
>
> --
> Regards,
> Christopher
> _______________________________________________
> dhcp-users mailing list
> [hidden email]
> https://lists.isc.org/mailman/listinfo/dhcp-users
>


_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users
Reply | Threaded
Open this post in threaded view
|

Re: syntax question

Christopher Barry
Thanks Glen, I missed that man page.

-C


On Sep 2, 2017 12:48 AM, "Glenn Satchell" <[hidden email]> wrote:
Hi Christopher

Here's what it says in the dhcp-eval man page

substring (data-expr, offset, length)

       The substring operator evaluates the data  expression  and
       returns  the  substring  of  the result of that evaluation
       that starts offset bytes from  the  beginning,  continuing
       for  length  bytes.   Offset  and  length are both numeric
       expressions.  If data-expr, offset or length  evaluate  to
       null,  then the result is also null.  If offset is greater
       than or equal to the length of the evaluated data, then  a
       zero-length data string is returned.  If length is greater
       then the remaining length  of  the  evaluated  data  after
       offset, then a data string containing all data from offset
       to the end of the evaluated data is returned.

So just make length be a number bigger than your string is ever likely to
be, eg 1000, or 10,000, or 1,000,000 say.

regards,
-glenn

On Sat, September 2, 2017 12:03 am, Christopher Barry wrote:
>
> Hello everyone,
>
> I want to use the substring keyword to return a part of a string that
> starts at character 5, and goes to the end of the string. The strings
> will be of variable length. Do I simply omit the second numeric
> parameter to accomplish that? I can't find anything about this in the
> man pages.
>
> Thanks
>
> --
> Regards,
> Christopher
> _______________________________________________
> dhcp-users mailing list
> [hidden email]
> https://lists.isc.org/mailman/listinfo/dhcp-users
>


_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users

_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users