Regular Expressions 101

Community Patterns

Gets param info from ncdump

0

Regular Expression
PCRE (PHP <7.3)

/
^\s*(?'param'.*):long_name = "(?'def'.*)" ;(\n^.*:units = "(?'units'.*)" ;$)?
/
gm

Description

input string from find . -type f -iname "*.nc" | while read i; do ncdump -h "$i"; done | grep -E "long_name|units"

output is comma delimited param info: name, description, units

  • [required] source of definition is netcdf long_name
  • [optional] source of units is netcdf units

If redundant parameters you will want to do a sort and uniq after this.

Submitted by anonymous - 4 years ago