Hi,
How can I remove trialing digits from a string ?
this 5
test 556
test5
thank you.
SOLVED : Bash remove trailing digits
-
chris
- Site Admin
- Posts: 216
- Joined: Mon Jul 21, 2008 9:52 am
Re: Bash remove trailing digits
You can use
But this will remove all digits not only at the end.
Better is to use sed
Code: Select all
VARIABLE="test 556";
VARIABLE=${VARIABLE//[0-9]/};Better is to use sed
Code: Select all
VARIABLE=`echo $VARIABLE | sed -e 's/[0-9]*$//g'`;-
chris
- Site Admin
- Posts: 216
- Joined: Mon Jul 21, 2008 9:52 am
Re: Bash remove trailing digits
Thanks that is what I was looking for 