Quote:
Originally posted by crabboy
how about:
Code:
basename /usr/src/file.txt | cut -s -d'.' -f2
It will not work correclty if there are more than one '.' in the filename.
So perhaps a regular expression:
Code:
for i in `ls`; do
echo $i{##*[.]}
done
|
brilliant thank you
cp "$(dcop amarok player path)" "$(dirname "$(dcop amarok player path)")"/0"$(dcop amarok player track)"\ -\ "$(dcop amarok player artist)"\ -\ "$(dcop amarok player title)"."$(basename "$(dcop amarok player path)" | cut -s -d'.' -f2)"
## */ Copies song currently playing in Amarok to the same directory it already is with filename based on id3track - id3artist - id3title . original extension /*
Basically mv will rename it instead. cp is for debugging purposes
i don't know how your second suggestion can be used however the first one is more than sufficient.
and what does the
"| "
do in the command basename /usr/src/file.txt | cut -s -d'.' -f2