$ var='Hello, World!' $ echo "${#var}" 13
$ var='Hello, World!' #${string:position:length} $ echo "${var:0:5}" Hello
$ var='Hello, World!' #${string:position:length} $ echo "${var:7:${#var}}" World! #or a litte more dynamic.. (the 6 most right chars) echo "${var:$((${#var}-6)):${#var}}" World!
$ var='Hello, World!' #${string:position:length} $ echo "${var:4:4}" o, W
$ var='Hello, World!' #${string/substring/replacement} $ echo "${var/o/a}" Hella, World!
$ var='Hello, World!' #${string//substring/replacement} $ echo "${var//o/a}" Hella, Warld!
Reference: http://www.netmess.org/tag/bash/
~~LINKBACK~~