I had a list of mp3 files like:
ANBE_VAA_ARUGILE.MP3
ANBU_THAYAE.MP3
ANDANVAN_THEANAKTRU.MP3
ANNANENNA.MP3
and wanted the list of song names from this… What shall we do?
* Open Cygwin (Unix emulator within Windows), navigate to that folder, do:
ls | cut -d. -f1 | sed –e 's/_/ /g'
list the files in this directory, cut and extract the 1st field with delimiter as . character, then substitute space character in place of _ character globally. In other words, get the actual filename removing the .mp3 extension, then replace underscores with spaces.
* Save the above output to a file
Actually this too should be a part of the above step, like:
ls | cut -d. -f1 | sed –e 's/_/ /g' > ./songnames.txt
The file songnames.txt now has:
ANBE VAA ARUGILE
ANBU THAYAE
ANDANVAN THEANAKTRU
ANNANENNA
* Open the file in Vim editor, and select all the text by pressing ggVG. Then, press : to enter command mode, and Vim will show :’<,’> and wait for your input. Type this:
!perl –lpe "@words = map { ucfirst(lc($_)) } split; $_ = join(\" \", @words)"
and press enter, and voila, the list has become:
Anbe Vaa Arugile
Anbu Thayae
Andanvan Theanaktru
Annanenna
Beautiful, isn't it?
Thank God, Unix exists! :)