Monday, December 5, 2011

Sub strings

ubuntu1004@ubuntu1004:~$ mystr="ubuntu1004"
ubuntu1004@ubuntu1004:~$ echo $mystr
ubuntu1004
ubuntu1004@ubuntu1004:~$ echo ${#mystr}
10
ubuntu1004@ubuntu1004:~$ echo ${mystr:0:6}
ubuntu
ubuntu1004@ubuntu1004:~$ echo ${mystr:1:6}
buntu1
ubuntu1004@ubuntu1004:~$ echo ${mystr:1:5}
buntu
ubuntu1004@ubuntu1004:~$ echo ${mystr:6:10}
1004

No comments:

Post a Comment