13
2
|
I want to parse a variable (in my case it's development kit version) to make it dot(
. ) free. If version='2.3.3' , desired output is 233 .
I tried as below, but it requires
. to be replaced with another character giving me 2_3_3 . It would have been fine if tr . '' would have worked.
| ||
19
|
There is no need to execute an external program.
bash 's string manipulation can handle it (also available in ksh (where it comes from) and zsh ):
(In those shells' manuals you can find this in the parameter expansion section.)
| |||
10
|
By chronological order:
tr/sed
csh/tcsh
POSIX shells:
ksh/zsh/bash
zsh
| |||
2
|
you should try with
sed insteadsed 's/\.//g' |
echo "2.3.3" | tr -d .
. – manatwork Dec 12 '13 at 14:59VERSION='2.30.3100'
? No matter what just.
's are removed with all of the answers here. – Prayag Upd Dec 12 '13 at 16:13