1

Can anyone tell me what I am doing wrong ?

[ /jlr/sub/libexec/vmr-staging ] $ expr substr "onetwothree" 1 4
expr: syntax error

I got the syntax from https://stackoverflow.com/a/220464/1150847

1 Answers1

2

The substr operation is a non standard extension and not supported on all OSes (probably linux only). The same be achieved with cut:

echo "onetwothree" | cut -c 1-3
kofemann
  • 4,626
  • 1
  • 25
  • 30