In a for loop like this one:
for f in `ls *.avi`; do echo $f; ffmpeg -i $f $f.mp3; done
$f will be the complete filename, including the extension. For example, for song1.avi the output of the command will be song1.avi.mp3. Is there a way to get only song1, without the .avi from the for loop?
I imagine there are ways to do that using awk or other such tools, but I’m hoping there’s something more straight forward.
Thanks
Use bash parameter expansion
Note that you need the greedy version because there are multiple dots in the file name.
From bash manual: