Linux and Networking

Linux and Networking

4.23. Finding out the numerical position of a substring in a string.

To find out this position we will use the index parameter of the expr command. Let’s see an example of using this command:

 

$stringMY=ArrozConSocarrat

$echo `expr index “$stringMY” Con`

7

 

As an exercise, we suggest that you execute the three commands in the previous code.

The Demeter Project