Linux tips and tricks
Monday, May 12, 2014
Bash - Substring
How to get substring in Bash script? Simple :)
if we have string:
$ a=123456789
substring from position 1 to 5 is
$ echo ${a:1:5}
23456
First position in a string is 0.
in general:
${varname:start_pos:length}
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment