String and ustring field conversions

Use the modify operator to perform the following modifications involving string and ustring fields:

The following osh command converts a string field to lowercase:

osh "... | modify "lname=lowercase_string(lname)" | peek"

The diagram shows a modification that converts the name of aField to field1 and produces field2 from bField by extracting the first eight bytes of bField:

Shows the modify operator being used to convert a string to lowercase characters

The following osh command performs the substring extraction:

modify 'field1 = aField; field2 = substring[0,8](bField);'

The diagram shows the extraction of the string_length of aField. The length is included in the output as field1.

Shows the modify operator being used to extract the length of a string

The following osh commands extract the length of the string in aField and place it in field1 of the output:

$ modifyspec="field1 = string_length(aField); field2 = aField;"
$ osh " ... | modify '$modifySpec' |... "

Notice that a shell variable (modifySpec) has been defined containing the specifications passed to the operator.