Extracting sub string at Bash is very easy, let say you have a phone number 012-4567890 and you just wanna extract 4567890 out, you can do as below.
num="016-4567890";
echo ${num:5:7}
567890
O/P is 567890
5 is the starting point and 7 is the string length for sub string.
No comments:
Post a Comment