Small scripting query: lowercase
I have several directories of subtitles for some videos, but all the text for the subtitles in each file is in uppercase, and I would like to convert the files' content to lowercase, all in one go. I found on a website a bash command that would do each file separately:
tr '[:upper:]' '[:lower:]' <input.txt> output.txt
... but of course involves specifying the input name and output name for each file.
I have been trying to do it in a script that would work for all files in the current directory, without having to rename them each time, if that's possible. So far I've got the following, which doesn't work:
#!/bin/bash
for file in $@; do
tr '[:upper:]' '[:lower:]'
done
However, my web searches cannot locate a way of specifying "each file in current directory" in conjunction with the "tr" command, but also without having to rename the file once converted to lowercase. Is it possible, or would the tr command have to create a new file for each converted file?
Thank you for any advice you can give.
Last edited by Steve W; 03-23-2011 at 04:37 AM.
|