[j-nsp] "replace pattern" Command & White Spaces

Phil Shafer phil at juniper.net
Sat Jul 30 15:19:22 EDT 2016


Saku Ytti writes:
>Consider you have metric 42, you want to change that to 43. Now you
>probably don't want to risk changing every 42 => 43, because 42 could
>be used in many context. So you'd maybe want to do replace "metric 42"
>"metric 43", you can't, it won't have visibility on syntax/keyword
>'metric', only on the variable/value '42'.

Yup, it's field-oriented, since it's making changes in the database
directly; we're not generating text, pattern matching, and then
making change payloads.  Instead we're traversing the database,
pattern matching each "leaf" in the database.  So you get "^" and
"$", but not keywords like metric.  It's definitely a trade-off,
but we've never really hidden the fact that we're not really keeping
the data in a straight text file.

FWIW, 'replace pattern "foo bar" with "moo"' work fine for me.

Thanks,
 Phil


More information about the juniper-nsp mailing list