Hi all,
I have been trying to replace a word and a set of numbers with a hyphen and a leading zero (if required) but with failure.
For example the text "abc123" needs to be "abc-123" or "xyz1" needs to be "xyz-01".
In the case for the numbers i have been trying to place a leading zero if the number is below 10 but havent been able to do so
My attempt was:
#!/bin/sh
INPUT=$1
RESULT=`echo $INPUT | tr "[:lower:]" "[:upper:]" | sed 's/([A-Z])$/([A-Z])-/g' | sed 's/^\([0-9]\)$/0\1/g'`
echo "$RESULT"
Any suggestions please??