strip - UDM Command

Syntax

strip variable_name sequence [num=index] [all=yes|no] [case=yes|no]

Description

The strip command strips occurrences of a sequence from a string.

The first parameter, variable_name, is the name of an existing variable or list element on which to perform the strip. The sequence parameter specifies the sequence to be stripped.

The optional num parameter indicates the occurrence number of the sequence that is to stripped.

The optional all parameter indicates whether all instances (yes) or only the first instance (no) of the sequence are stripped. (If all is not specified, it is assumed that only the first instance is stripped).

The optional case parameter specifies whether the comparison to find the sequence is case sensitive (yes) or case insensitive (no). [Default is no.]

Parameters

Parameter

Description

variable_name

Name of the existing variable or list element on which to perform the strip.

sequence

Sequence to be stripped

num=index

One-based sequence number that identifies the occurrence of the sequence to be stripped.

all=yes | no

Specification for whether all instances (yes) of the sequence are replaced or only the first instance (no) of the sequence.

case= yes | no

Specification for whether the comparison to match the old sequence is case sensitive (yes) or case insensitive (no).

[Default is no.]

Examples

The following strip command examples use a predefined variable, mystring, with a value of abcabcabc.

strip mystring ab all=yes
echo "$(mystring)"
ccc

strip mystring abc num=1
echo "$(mystring)"
abcabc