Raptor
10-03-2006, 15:45
Ich braeuchte bitte ein wenig Hilfe bei folgenden kleinen Programm:
Ich habe in einer Directory einen Haufen Files, die alle mit Zwei Ziffern beginnen.
Diese anfaenglichen Ziffern moechte ich eliminieren.
Ich habe dazu folgendes Programm gescriptet
for i in `ls`
do
mv $("$i") `echo $("$i") | tail --bytes=$((`echo $("$i") | wc --chars` -2))`
done
Es funktioniert noch nicht ganz, weil es dadurch Probleme gibt, dass die bash Filenames, die einen Blank enthalten in mehrere Zeichen aufbricht.
Hier mal ein log:
UniX:~/test/testarea/mukke$ ls
01 - Anthem Part Two.mp3 01 - Blues for Shorty Bill.mp3 01 - Dumpweed.mp3
01 - Avril Lavigne - Sk8er.mp3 01 - Carousel.mp3 01 - Ensiferum - Intro.mp3
UniX:~/test/testarea/mukke$ sh ../elimFront.sh
../elimFront.sh: line 4: 01: command not found
../elimFront.sh: command substitution: line 4: unexpected EOF while looking for matching `)'
../elimFront.sh: command substitution: line 5: syntax error: unexpected end of file
../elimFront.sh: line 4: 01: command not found
../elimFront.sh: command substitution: line 4: syntax error near unexpected token `)'
../elimFront.sh: command substitution: line 4: ` -2))'
mv: missing destination file operand after `echo | wc --chars'
Try `mv --help' for more information.
../elimFront.sh: line 4: -: command not found
../elimFront.sh: command substitution: line 4: unexpected EOF while looking for matching `)'
../elimFront.sh: command substitution: line 5: syntax error: unexpected end of file
../elimFront.sh: line 4: -: command not found
../elimFront.sh: command substitution: line 4: syntax error near unexpected token `)'
../elimFront.sh: command substitution: line 4: ` -2))'
mv: missing destination file operand after `echo | wc --chars'
[und so weiter]
....
Any help?
Ich habe in einer Directory einen Haufen Files, die alle mit Zwei Ziffern beginnen.
Diese anfaenglichen Ziffern moechte ich eliminieren.
Ich habe dazu folgendes Programm gescriptet
for i in `ls`
do
mv $("$i") `echo $("$i") | tail --bytes=$((`echo $("$i") | wc --chars` -2))`
done
Es funktioniert noch nicht ganz, weil es dadurch Probleme gibt, dass die bash Filenames, die einen Blank enthalten in mehrere Zeichen aufbricht.
Hier mal ein log:
UniX:~/test/testarea/mukke$ ls
01 - Anthem Part Two.mp3 01 - Blues for Shorty Bill.mp3 01 - Dumpweed.mp3
01 - Avril Lavigne - Sk8er.mp3 01 - Carousel.mp3 01 - Ensiferum - Intro.mp3
UniX:~/test/testarea/mukke$ sh ../elimFront.sh
../elimFront.sh: line 4: 01: command not found
../elimFront.sh: command substitution: line 4: unexpected EOF while looking for matching `)'
../elimFront.sh: command substitution: line 5: syntax error: unexpected end of file
../elimFront.sh: line 4: 01: command not found
../elimFront.sh: command substitution: line 4: syntax error near unexpected token `)'
../elimFront.sh: command substitution: line 4: ` -2))'
mv: missing destination file operand after `echo | wc --chars'
Try `mv --help' for more information.
../elimFront.sh: line 4: -: command not found
../elimFront.sh: command substitution: line 4: unexpected EOF while looking for matching `)'
../elimFront.sh: command substitution: line 5: syntax error: unexpected end of file
../elimFront.sh: line 4: -: command not found
../elimFront.sh: command substitution: line 4: syntax error near unexpected token `)'
../elimFront.sh: command substitution: line 4: ` -2))'
mv: missing destination file operand after `echo | wc --chars'
[und so weiter]
....
Any help?