Ladies & Gents
It seams that I am unable to figure this out at this time. I do remember reading about a similar thing at one point over on stack exchange or somewhere but can't find it at the moment.
What I am trying to do is change a number (100 through 150) say 101 to a1 to be used as part of a file name.
Code:
count=101
elif ((count > 99))&&((count < 110));then
echo $count | sed '/^10/a/'> $chapter
echo $chapter
results in the following when executed
Code:
+ echo 101
+ sed '/^10/a/'
+ echo 71
I have tried several iterations of the above sed command with no joy.
In another place where I have a very similar sed, except with a "d" instead of an "a" I get a different error
Code:
+ echo 131
+ sed '/^13/d/'
sed: -e expression #1, char 7: extra characters after command
+ echo 71
The relevant code
Code:
count=$1
for (( a = 1; a < 6; a++)); do
local chapter
if ((count < 100)); then
chapter=$count
echo $chapter
elif ((count > 99))&&((count < 110));then
echo $count | sed '/^10/a/'> $chapter
echo $chapter
elif ((count > 109))&&((count < 120));then
echo $count | sed '/^11/b/' > $chapter
echo $chapter
elif ((count > 119))&&((count < 130));then
echo $count | sed '/^12/c/' > $chapter
echo $chapter
elif ((count > 129))&&((count < 140));then
echo $count | sed '/^13/d/' > $chapter
echo $chapter
elif ((count > 139))&&((count < 150));then
echo $count | sed '/^14/e/' > $chapter
echo $chapter
else
chapter="f0"
fi
count=$((count + 30))
done
It seams to exhibit this behavior every time it tries to make the change. If I had more time to play I might be able to figure it out by myself but play times is very limited due to my work load.
Thanks for any pointers.