The below example will:
1. Remove/Trim last 3 characters of a string variable.
2. It does it in one go...
VAR = "ap-southeast-1a"
VAR=${VAR%%???}
echo $VAR
This will output:
ap-southeast
Simple... Isn't It?
1. Remove/Trim last 3 characters of a string variable.
2. It does it in one go...
VAR = "ap-southeast-1a"
VAR=${VAR%%???}
echo $VAR
This will output:
ap-southeast
Simple... Isn't It?
Slick, and simple. Thanks
ReplyDeletesuppose string is 10:45:06:247 How can I replace it to 10:45:06.247. last colon changed with dot
ReplyDelete