I suggest that you clearly specify what it is you are trying to do. Also, you say that your script doesn't work on the non-test files. What do you mean by this? In what sense does your script fail? For example, does it generate garbage output? Does it fail to do anything? What happens?
]]>If so, you could use awk:
#!/bin/bash
file='/mnt/files/mysecondhome/Upkeep/Arch.Upkeep/Music/play3'
awk '{ print $1, $2+1 }' "$file" > /home/ryan/Upkeep/Music/play2
ZZZZZmntZZZZZfilesZZZZZmysecondhomeZZZZZMusicZZZZZWallsYYYYYJJJJJfYYYYYJerichoZZZZZWithYYYYYDevilsYYYYYAmongstYYYYYUsYYYYYAllZZZZZWelcomeYYYYYHomeXXXXXmpCCCCC 0
ZZZZZmntZZZZZfilesZZZZZmysecondhomeZZZZZMusicZZZZZWallsYYYYYJJJJJfYYYYYJerichoZZZZZWithYYYYYDevilsYYYYYAmongstYYYYYUsYYYYYAllZZZZZWithYYYYYDevilsYYYYYAmongstYYYYYUsYYYYYAllXXXXXmpCCCCC 0
ZZZZZmntZZZZZfilesZZZZZmysecondhomeZZZZZMusicZZZZZWarZZZZZWhyYYYYYCan'tYYYYYWeYYYYYBeYYYYYFriendsVVVVVZZZZZLowYYYYYRiderXXXXXmpCCCCC 1
ZZZZZmntZZZZZfilesZZZZZmysecondhomeZZZZZMusicZZZZZWarpstoneZZZZZDaemonicYYYYYWarpfireZZZZZAYYYYYStrangeYYYYYWindYYYYYIsYYYYYWaillingYYYYYForYYYYYTheYYYYYDeadXXXXXmpCCCCC 0
ZZZZZmntZZZZZfilesZZZZZmysecondhomeZZZZZMusicZZZZZWarpstoneZZZZZDaemonicYYYYYWarpfireZZZZZBloodYYYYYPaintedYYYYYMountainXXXXXmpCCCCC 0
play3:
ZZZZZmntZZZZZfilesZZZZZmysecondhomeZZZZZMusicZZZZZWarZZZZZWhyYYYYYCan'tYYYYYWeYYYYYBeYYYYYFriendsVVVVVZZZZZLowYYYYYRiderXXXXXmpCCCCC 1
i wasn't sure if certain special caracters or numbers were messing it up so thats whats with the zs ys vs xs and cs. also -i doesn't help
]]>You're constantly overwriting /home/ryan/Upkeep/Music/play2 with the single > redirect so only the last loop counts.
You probably want to copy playcount1 and then use sed -i on it.
]]>#!/bin/bash
file='/mnt/files/mysecondhome/Upkeep/Arch.Upkeep/Music/play3'
cat ${file} | \
while read name num
do
sum=$(($num + 1))
sed s/"$name $num/$name $sum"/g /mnt/files/mysecondhome/Upkeep/Arch.Upkeep/Music/playcount1 > /home/ryan/Upkeep/Music/play2
done
I took a sample from the non-test files and put it in the test files, and it works. I'm not really sure what to do now, thanks in advance for your help.
]]>